Xml
There are always exceptions to the rules. There is one exception to my rule on attributes: Sometimes I assign an ID reference value to an element. These ID reference values can be used to access XML elements that are essentially exactly the same as the name or ID attribute in HTML. This is illustrated by the following example:
< messages>
< note id= "501" >
< to>tove</to>
< from>jani</from>
< heading>reminder< Body>don ' t forget me this weekend!</body>
</note>
< note id= "502" >
< to>jani</to>
< from>tove</from>
< heading>re:reminder< Body>i would not!</body>
</note>
</messages>
The IDs in these examples are just a counter, or a unique identification number, used to identify different annotations in the XML file, not as part of the annotation data. What I'm trying to illustrate here is that metadata (data about data) should be stored as attributes, and that the data itself should be stored as elements.
XML validation
The correct syntax for XML is well-formed XML. XML that is validated with a DTD is called valid XML.
"Well-Formed" XML document
A "well-formed" XML document has the correct XML syntax.
< XML version= "1.0"?>
< note>
< to>tove</to>
< from>jani</from>
< heading>reminder< Body>don ' t forget me this weekend!</body>
</note>
"Valid" XML document
A "valid" XML document also conforms to the DTD. A "valid" XML document is a "well-formed" XML document, and it also conforms to the rules of the document type definition (DTD).
< XML version= "1.0"?>
<! DOCTYPE Note SYSTEM "INTERNALNOTE.DTD" >
< note>
< to>tove</to>
< from>jani</from>
< heading>reminder< Body>don ' t forget me this weekend!</body>
</note>
XML DTD
A DTD defines a legitimate element in an XML document. The purpose of a DTD is to define the legal structure area of an XML document. It defines the structure of the document with a list of legitimate elements. You can read more about DTDs and how to validate your XML documents in the W3Schools ' DTD school.
XML Plan
Xschema is a substitute for an xml-based DTD. The consortium supports a DTD substitute called an XML schema. More content about XML schemas can be found in the W3Schools ' schema School.
Mistakes will make you stop.
An error in the XML document stops the XML program. The XML specification for the consortium provides that when a validation error is found in a program, it cannot continue processing an XML document. The reason is that XML software should be easy to write, and all XML documents should be compatible with each other.
With HTML, you might create a document with many errors (for example, you sometimes forget a closing tag). One of the main reasons HTML browsers are large and incompatible is that when they encounter an HTML error, they have different ways of describing what the document should look like. It is impossible to use XML.
-->