来自带有内联 Xsd 的 XML 文件的 XmlSchema 对象
在 .Net 中,我试图从带有嵌入式 Xsd 的 Xml 文件中获取 XmlSchema 对象,但不知道该怎么做?有人知道吗?
例如,如果它只是一个 Xml 文件,我可以使用 XmlSchemaInference 类推断架构,或者如果它是一个 Xsd,我可以使用 XmlSchema 类,但找不到内联 Xsd。
示例文件位于 http://pastebin.com/7yAjz4Z4 (由于某种原因不会显示在此处)
谢谢你
In .Net, I'm trying to get a XmlSchema object from Xml file with an embedded Xsd and can not find out how to do it? anybody know?
For example if it just an Xml file I can Infer Schema using the XmlSchemaInference class or if its a Xsd I can use XmlSchema class, but can not find away with inlined Xsd.
example file is at http://pastebin.com/7yAjz4Z4 (for some reason wouldn't show on here)
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可以通过获取
xs:schema
元素节点的XmlReader
并将其传递给XmlSchema.Read
来完成。(如果您使用的是
XmlDocument
而不是XDocument
,请查看XmlNode.CreateNavigator().ReadSubtree()
。)This can be done by obtaining an
XmlReader
for thexs:schema
element node and passing it toXmlSchema.Read
.(If you are using
XmlDocument
instead ofXDocument
, look intoXmlNode.CreateNavigator().ReadSubtree()
.)我最终选择了这个。非常感谢您的帮助。
I went for this in the end. Thank you very must for your help.