How to choose between DTD and XSD

前端 未结 7 2102
南旧
南旧 2020-12-02 10:37

I want to use either a DTD or an XSD to describe my XML document. I\'ve read that XSDs are better than DTDs since they support namespaces and data types, and that DTDs are o

相关标签:
7条回答
  • 2020-12-02 11:11

    It's probably important to learn DTDs as a separate exercise, just for the knowledge of how they work in case you encounter them somewhere else, and so that you can appreciate some of the things that XSD was trying to solve.

    However, for your current purposes of describing an XML document, indeed stick to XSDs.

    In addition to having a far richer feature set (like you mention, including data types and namespaces), they are also XML documents themselves, which can be really useful. Because they are XML, you can check their well-formedness and validity a lot easier, and you can write code that works with them like regular XML files (for instance, if you wanted to autogenerate code classes from a schema)

    0 讨论(0)
提交回复
热议问题