开发者

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

开发者 https://www.devze.com 2022-12-16 05:06 出处:网络
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.

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号