Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read XML into xsd.exe generated classes. Good idea?

I have a fairly complex XML coming my way and I have the XSD for it. I generated classes via xsd.exe and read XML into the class structure via the XmlSerializer described here.

It works great. However, this is the first time I've done it this way and I'll be reading in tons of XML files going forward from various sources. How reliable is this method? Could one say with certainty that if the XML file conforms to the XSD specification, that the XmlSerializer will be able to read it in just fine?

like image 697
AngryHacker Avatar asked Jan 07 '10 19:01

AngryHacker


1 Answers

Short answer: it's better. This is exactly how MSfts web services work, so if what you described didn't work, any of the .NET consumers would fail, like when you add a reference to a web service in .NET or Silverlight.

like image 89
jvenema Avatar answered Oct 23 '22 04:10

jvenema