* has a couple of great questions contrasting XSD and DTD and choosing between XSD and DTD. But I came across a data format and library that used both XSD and DTD. The XML documents specify the DTD but the supporting library requires the XSD to encode and decode.
*有一些很好的问题,对比XSD和DTD,并在XSD和DTD之间进行选择。但我遇到了一个同时使用XSD和DTD的数据格式和库。 XML文档指定DTD,但支持库需要XSD进行编码和解码。
What are the benefits of using an XSD and DTD at the same time?
同时使用XSD和DTD有什么好处?
1 个解决方案
#1
6
The most significant time I've seen both DTD and XSD used together relates to the example you cite: A sector standards group had defined their XML vocabulary and grammar long ago using DTD, yet particular consumers of the XML wanted to use tools such as JAXB that require a XSD. So, the consumers created a parallel schema using XSD to be able to take advantage of tools or satisfy other dependencies requiring XSD while maintaining compatibility with the schema specified via previously established DTDs.
我看到DTD和XSD一起使用的最重要的时间与您引用的示例有关:扇区标准组很久以前使用DTD定义了他们的XML词汇和语法,但XML的特定使用者希望使用诸如JAXB之类的工具需要XSD。因此,消费者使用XSD创建了一个并行模式,以便能够利用工具或满足需要XSD的其他依赖项,同时保持与通过先前建立的DTD指定的模式的兼容性。
Other than to address such legacy concerns, don't bother with DTD. New projects should solely use more modern XML schema languages such as XSD, RELAX NG, or Schematron.
除了解决这些遗留问题之外,不要打扰DTD。新项目应该只使用更现代的XML模式语言,如XSD,RELAX NG或Schematron。
#1
6
The most significant time I've seen both DTD and XSD used together relates to the example you cite: A sector standards group had defined their XML vocabulary and grammar long ago using DTD, yet particular consumers of the XML wanted to use tools such as JAXB that require a XSD. So, the consumers created a parallel schema using XSD to be able to take advantage of tools or satisfy other dependencies requiring XSD while maintaining compatibility with the schema specified via previously established DTDs.
我看到DTD和XSD一起使用的最重要的时间与您引用的示例有关:扇区标准组很久以前使用DTD定义了他们的XML词汇和语法,但XML的特定使用者希望使用诸如JAXB之类的工具需要XSD。因此,消费者使用XSD创建了一个并行模式,以便能够利用工具或满足需要XSD的其他依赖项,同时保持与通过先前建立的DTD指定的模式的兼容性。
Other than to address such legacy concerns, don't bother with DTD. New projects should solely use more modern XML schema languages such as XSD, RELAX NG, or Schematron.
除了解决这些遗留问题之外,不要打扰DTD。新项目应该只使用更现代的XML模式语言,如XSD,RELAX NG或Schematron。