java - Unmarshalling xml where the only difference is the schema -


i have unmarshall xml java classes. xml schemas have been versioned (currently on version 3). receiving 2 different events share common elements, common elements of different version. kicker is, versions not matter me. have events:

<event1 xmlns:com="http://www.foo.com/common">     <com:name>          <com:first>phil<com:/first>     </com:name> </event1>  <event2 xmlns:com2="http://www.foo.com/commonv2">     <com2:name>          <com:first>phil<com:/first>roger     </com2:name> </event2> 

since, in case wrote code event 2 first, code looks like:

@xmlrootelement(name = "name", namespace = "http://www.foo.com/commonv2") public class name {         private string firstname;      @xmlelement(name = "first", namespace = "http://www.foo.com/commonv2")     public void setfirstname(string firstname) {         this.firstname = firstname;     } } 

is there way can reuse name class both event1 , event2 despite them being made of different schemas?


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -