Let validation do what it can, but ultimately your program must explicitly verify that an XML file contains the correct data.The Document Type Definition is part of the XML specification.
There are multiple ways to validate input, and this article will look at two of them: Document Type Definitions (DTD) and XML Schema (XSD).
A third option is Relax NG, which tries to find a middle ground between DTD's lack of expressiveness and XSD's Byzantine structure. Before continuing, I want to add a third, non-standard term to describe XML documents: “correct.” A validator can only check the existence, ordering, and general content of an XML file; it's equivalent to the syntax check of a Java compiler.
For example, XML generated using simple string output in a Windows environment will probably be encoded in .
Normally, this isn't an issue, especially if the XML is both produced and processed within the same organization.
Except for one small problem: the Namespace spec was introduced in 1999, while the DOM level 1 spec was released in 1998 and knew nothing of namespaces.