XML Getting Started Tutorial: Validating XML as legitimate XML

Source: Internet
Author: User
Tags define xml attribute xml parser
xml| Tutorials | Getting Started

XML with the correct syntax is a good form of XML.

XML that is validated with some kind of DTD is legitimate XML.

Make a good XML document

A "well-formed" XML document has the correct syntax.

A "W-well-formed" XML document follows the XML syntax rules described in the previous chapters:

    • The XML document must have a root element
    • The XML document must have a close tag
    • XML tags are case sensitive
    • XML elements must be nested correctly
    • XML attribute must be quoted
<?xml version= "1.0" encoding= "iso-8859-1"? ><note><to>tove</to><from>jani</from >

Validating an XML document

A legitimate XML document also complies with a DTD.

A legitimate XML document is a "well-formed" XML document that also adheres to the syntax rules of the document type definition (DTD):

XML DTD

A DTD defines the legitimate elements of an XML document.

The role of DTDs is to define the legitimate building blocks of XML documents. It uses a range of legitimate elements to define the document structure. You can get more information about DTDs in our DTD tutorial, and how to validate XML documents.

XML Schema

An XML Schema is an xml-based DTD substitute.

The consortium supports a standard named XML Schema as an alternative to DTDs. You can get more information about XML schemas in our XML Schema tutorial.

A generic Validator

To help you examine the syntax of the XML file, we created this tool so that you can check any XML file for syntax.

XML error will terminate your program

Errors in the XML document will terminate your XML program.

The XML specification declaration of the Consortium: if there is an error in the XML document, then the program should not continue to process the document. The reason is that XML software should be easy to write, and that all XML documents should be compatible.

If you use HTML, it is possible to create a document that contains a large number of errors (for example, you forget an end tag). One of the main reasons is that HTML browsers are pretty bloated and poorly compatible, and they have their own way of determining what the document should look like when it finds an error.

With XML, this should not be the case.

Syntax checking of your XML-only for IE browsers

To help you with the syntax checking of XML, we created an XML validator using Microsoft's XML parser.

Paste your XML into the following text box, and then click the "Verify" button to check the grammar.



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.