I have identical objects in both a c# server app and a java client app. The server XML serializes these objects and makes them available through a REST service. The java app downloads the data in XML format. What is the best way to deserialize the xml data to my java objects? I am currently using Java org.w3c.dom classes to parse the xml and create new objects. I understand that certain types like dates and byte arrays will have to be handled manually, but a point in the right direction would be appreciated.
C# Class:
public class Sample {
public string MyText { get; set; }
public bool Flag { get; set; }
//many more fields
}
Java Class:
public class Sample {
public String MyText;
public boolean Flag;
}
Here is the xml thats coming from the c# web app:
<?xml version="1.0" encoding="utf-8"?>
<Sample xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MyText>Blah Blah</MyText>
<Flag>false</Flag>
</Sample>