XML documents that conform to syntax are called well-formed XML documents. XML documents validated through DTDs are called valid XML documents.
--------------------------------------------------------------------------------
Well-structured XML document
A well-formed XML document should use the correct syntax.
A well-formed XML document should adhere to the XML syntax rules, and the example given in the previous chapter is a well-formed XML document:
<?xml version= "1.0" encoding= "Iso-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<body>don ' t forget me this weekend!</body>
</note>
--------------------------------------------------------------------------------
"Valid" XML document
A valid XML document should conform to the description of the DTD.
A valid XML document is also a well-formed XML document and must conform to the rules of the DTD.
<?xml version= "1.0" encoding= "Iso-8859-1"?>
<! DOCTYPE Note SYSTEM "INTERNALNOTE.DTD" >
<note>
<to>Tove</to>
<from>Jani</from>
<body>don ' t forget me this weekend!</body>
</note>
--------------------------------------------------------------------------------
XML DTD
A DTD defines the legitimate elements available in an XML document.
The intent of the DTD is to define the legal building blocks of the XML document. He determines the internal structure of an XML document by defining a series of legitimate elements. Well-structured XML documents are not necessarily valid XML documents, but valid XML documents must be well-formed XML documents. If you want to learn more about DTDs, you can refer to the DTD guide.
--------------------------------------------------------------------------------
XML Schema
XML Schema (XML Schema) is a substitute for XML based DTDs.
The consortium allows DTDs and schemas to be substituted for each other, and readers can learn more about them in the schema guide.
--------------------------------------------------------------------------------
Error
Errors that occur in an XML document will cause the XML program to stop.
XML Specification declaration for the Consortium: If a program finds a valid error in processing an XML document, the program should terminate. This is why XML software is relatively easy to write. All XML documents should be consistent.
In HTML, an HTML file may contain many errors, such as a meta with a start tag without a closing tag, which is one reason why the volume of HTML browsers is so large that when they find errors, they have different ways to determine how this HTML file should be displayed.
This will never happen in XML.