How to choose between DTD and XSD

前端 未结 7 2145
南旧
南旧 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 10:58

    This is an old string, BUT in case anyone else comes across it... from what I can tell DTD still has two benefits which XSD does not, namely the inclusion of the ENTITY function which does not exist in XSD. This is a pretty awesome feature which tells the compiler how to process potentially unfamiliar file types by identifying what programs to open to process them.

    Also, DTDs are written into the XML spec so they can be written directly into XML documents whereas XSD has to exist as an outside file and connected. Not a big deal especially when using in bigger documents anyway.

    I think XSD is still far better and more natural since it uses XML syntax, just wanted to play devil's advocate :)

提交回复
热议问题