XML Validation

XML Validation


“Well Formed” XML documents

A “Well Formed” XML document is a document that conforms to the XML syntax rules that we described in the previous chapter.

The following is a “Well Formed” XML document:

<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

 


“Valid” XML documents

A “Valid” XML document is a “Well Formed” XML document which conforms to the rules of a Document Type Definition (DTD).

The following is the same document as above but with an added reference to a DTD:

<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "InternalNote.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

 


More about XML DTD

You can read more about DTD in the chapter XML DTD.