You could just create a Typed DataSet from the XSD and then fill one of those objects with the XML. That's the pretty common method.
Kjensen, can you elaborate on your problem a little ? What do you mean by
Generated classes (two actually), using xsd.exe ?
I guess that you want to create classes for parsing an xml file which should fullfill a given xsd. If so you can generate a .jar using apache xmlbeans
Read this:
http://xmlbeans.apache.org/documentation/tutorial_getstarted.html ..
Down load it from: http://www.apache.org/dist/xmlbeans/binaries/
Actually the simple command is goto the "bin" directory of "xml beans" (you've installed that)
then type
scomp -out <out.jar> <in.xsd>
that's it ..
Luis
PS: As far as I remember XMLspy brings also the possibility for automatically creating java classes for the same pourpose.
You could use the XmlSerializer to deserialize the XML text into instances of the classes generated by xsd.exe.
The XmlSerializer will use the metadata attributes placed on the generated classes to map back and forth between XML elements and objects.
string xmlSource = "<ResultSet><Result precision=\"address\"><Latitude>47.643727</Latitude></Result></ResultSet>";
XmlSerializer serializer = new XmlSerializer(typeof(ResultSet));
ResultSet output;
using (StringReader reader = new StringReader(xmlSource))
{
output = (ResultSet)serializer.Deserialize(reader);
}
The XSD Code Generator in Liquid XML Studio does a great job of creating highly compliant c# or vb.net code from an XML Schema. This code can then be used to call or implement a web service.
If your implementing a web service then you can take control of the WSDL produced using XmlSchemaProvider and IXmlSerializable, see Taking Control of your WSDL