XML document in proper format

Source: Internet
Author: User
Tags closing tag valid

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.