DTD to C# class

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I tried the DTD->XSD conversion in VS 2008 and then the XSD.EXE utility that is available to generate C#-classes. Then I used the following code to read an XML-file where the root element is WHOLE:
<pre lang="x-c# var xs = new XmlSerializer(typeof(WHOLE));
var xtr = new XmlTextReader("C:Tempglobal.xml");
var data = (WHOLE)xs.Deserialize(xtr);
xtr.Close();
[/code]
The strange thing is that the method call Deserialize is complaining about the file if I use the above approach, but if I I take my DTD-file and convert it to an XSD-file using e.g. Liquid XML Studio and use that XSD-file inside VS 2008
to generate the C# classes, there is no errors.
Is there some switches that I have missed in the generation? The strange thing is that it is the DTD->XSD conversion that "fails" and I find no configuration options there.
Thanks in advance!<br/>
Best regards<br/>
Lars

View the full article
 
Back
Top