在 .net 中使用 XML 文档类型定义
是否可以将 XML DTD 导入 Visual Studio 以生成代理类?
我有一个第三方 .dll,我需要与之交互,其设计类似于 XML 服务。 .dll 的接口全部由 XML 输入驱动,并以 XML 形式返回输出。 它的好处是所有输入和输出类型都定义良好。 坏消息是他们使用 DTD(文档类型定义)。
我真的不想手动构建 XML,但我只知道如何使用 XSD 文件 .Net
Is it possible to import an XML DTD into Visual Studio in order to generate a proxy class?
I have a third party .dll that I need to interface with that is designed like an XML service. The interface into the .dll is all driven by XML inputs, and returns output as XML. The nice thing about it is that all the input and output types are well defined. The bad news is that they use DTD (Document Type Definition).
I would really like not to have to build up the XML by hand, but I only know how to use XSD files .Net
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Visual Studio 可以将您的 DTD 转换为 XSD,此时您可以生成代理。
您应该能够将 DTD 加载到 XML 设计器中,选择“创建架构”,然后让 Visual Studio 从中推断出 XSD。
Visual Studio can handle converting your DTD to an XSD, at which point you could generate your proxy.
You should just be able to load your DTD into the XML designer, choose "Create Schema", and have Visual Studio infer the XSD from it.
将问题简化为您知道如何解决的问题。 DTD 和 XSD 大致相同,并且存在转换器来进行转换DTD 到 XSD。 您知道如何使用 XSD,因此您已将其简化为可解决的问题。
Reduce the problem to one you know how to solve. DTDs and XSDs are roughly equivalent, and converters exist to convert DTDs to XSDs. You know how to work with XSDs, so you've reduced it to a solvable problem.