Both these mechanisms provide a definition for the XML document, which serves two purposes primarily - Firstly, this is to ensure that the data that makes it past the parsing stage is at least in the right structure and the undesired input is rejected. Secondly, the definition documents the protocol in a standard, formal way, which makes it easier for developers to understand what’s available.
DTD (Document Type Definition): This format defines the elements that may be included in your document, what attributes these elements have and the ordering and nesting of the elements.
XSD (XML Schema Definition): XML Schemas provide a powerful mean to define your XML document structure and the limitations. XML Schemas are themselves XML documents. They reference the XML Schema Namespace and even have their own DTD.
Now, let us look at the 5 most prominent differences:
DTD (Document Type Definition): This format defines the elements that may be included in your document, what attributes these elements have and the ordering and nesting of the elements.
XSD (XML Schema Definition): XML Schemas provide a powerful mean to define your XML document structure and the limitations. XML Schemas are themselves XML documents. They reference the XML Schema Namespace and even have their own DTD.
Now, let us look at the 5 most prominent differences:
DTD (Document Type Definition) | XSD (XML Schema Document) | |
1 | Non-XML ! | This is a XML as well. |
2 | Not namespace aware. | Namespace aware. |
3 | Inline DTDs can be included within the XML document | Inline is not possible |
4 | DTD definition applies to the entire xml document | Can describe individual segments |
5 | Importantly, fails to address data typing | Can define to the detail of data types (custom complex and primitive types), incorporate inheritance and supports packaging and modularization (can be imported/included) |
This comment has been removed by the author.
ReplyDeletecan you post something for JPA..The queries written in it is very loose and the exception caught are also not proper.If allowed I can share one of my findings and bugs in JPA which is not listed in any good sites.Between good information on DTD and XSD.
ReplyDelete