将 XML 读入 xsd.exe 生成的类。好主意吗?

发布于 2024-08-17 00:15:51 字数 313 浏览 1 评论 0原文

我有一个相当复杂的 XML,并且我有它的 XSD。我通过 xsd.exe 生成类,并通过描述的 XmlSerializer 将 XML 读入类结构 此处

效果很好。然而,这是我第一次这样做,以后我将阅读来自各种来源的大量 XML 文件。这种方法的可靠性如何?是否可以肯定地说,如果 XML 文件符合 XSD 规范,XmlSerializer 将能够很好地读取它?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光与爱终年不遇 2024-08-24 00:15:51

简短的回答:更好。这正是 MSfts Web 服务的工作方式,因此如果您所描述的不起作用,任何 .NET 使用者都会失败,就像您在 .NET 或 Silverlight 中添加对 Web 服务的引用时一样。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文