U
udupi_mail
Can anybody suggest possible databinding options which would bind(map)
xml instance docs(which conforms to some pre-defined xsd) to a
PRE-EXISTING java object (see below example). I looked at xstream which
seems to be a good option for serializing/deserializing objects to xml
and vice-versa(xstream does not care for schemas). Same with JAXB,
Castor or Xmlbeans ..I have not found a way to map the below xml to my
custom java obj?
Any pointers will be very helpful.
TIA,
Guru.
an e.g. would be :
<schema>
<complexType>
<sequence>
<element name="name" type="string" />
<element name="deptid" type="int" />
</sequence>
</complexType>
</schema>
Instance doc:
<employee>
<name>Joe Trader</name>
<deptid>10</deptid>
</employee>
Custom Java obj (with no default const., accessors or mutators):
public class Employee
{
public final String name;
public final int deptid;
public Employee (String name, int deptid) // overloaded const.
{
this.name = name;
this.deptid = deptid;
}
}
xml instance docs(which conforms to some pre-defined xsd) to a
PRE-EXISTING java object (see below example). I looked at xstream which
seems to be a good option for serializing/deserializing objects to xml
and vice-versa(xstream does not care for schemas). Same with JAXB,
Castor or Xmlbeans ..I have not found a way to map the below xml to my
custom java obj?
Any pointers will be very helpful.
TIA,
Guru.
an e.g. would be :
<schema>
<complexType>
<sequence>
<element name="name" type="string" />
<element name="deptid" type="int" />
</sequence>
</complexType>
</schema>
Instance doc:
<employee>
<name>Joe Trader</name>
<deptid>10</deptid>
</employee>
Custom Java obj (with no default const., accessors or mutators):
public class Employee
{
public final String name;
public final int deptid;
public Employee (String name, int deptid) // overloaded const.
{
this.name = name;
this.deptid = deptid;
}
}