The structure and syntax of XML introductory refinement (2)

Source: Internet
Author: User
Tags definition format definition
xml| syntax

and the text indent symbol before "John"). So the parser will have different processing results when it passes the information to the application after the tag is removed.

If we want to tell the XML program explicitly, the whitespace in the tag has a clear meaning, do not casually remove (as in some poems, the space has its specific meaning
, you can add an XML built-in attribute--xml:space to the tag. such as (note the case of attribute names and values):

Poetry xml:space= "Preserver"

Motherland Ah! Motherland!

My motherland!

〈/poetry

In addition, in an XML file, if you want to use the special characters of table 1, you must replace them with the corresponding symbols.

Table 1 special character substitution symbols
&& &
<
> >
" "
' '

Here's a summary: XML files that conform to the above requirements are well-formed XML files. This is the most basic requirement for writing XML files. You can see the XML text
The grammatical rules of a piece are much stricter than HTML. With such strict rules, it is much easier for software engineers to write XML parsers, unlike the HTML language
Parser, must try to adapt to different Web page writing, improve their browser adaptability. In fact, this is a very important thing for our beginners
Good. How to do, do not have to be like the original to doubt all kinds of HTML writing.

We see that in XML files, most of them are custom tags. But consider if two companies in the same industry, A and B, want to use an XML file
Exchange of data, a company with the "price" tag to express their product price information, and B may use the "price" to indicate price information. If an XML
When the application is to read the information in their respective XML file, if it only knows the price information indicated in the price tag, then B Company's price information
Can not read out, will produce mistakes. Obviously, for entities that want to use XML files to exchange information, they must have a convention--writing XML
What tags can be used in a file, what child elements can be included in the parent element, the order in which each element appears, and how the attributes in the element are defined. So they're using XML
The exchange of data can be unimpeded. This Convention is referred to as a DTD (document Type definition, Documentation format definition). You can think of DTDs as writing XML text
Pieces of the template. For XML data interchange between industries, there is a fixed DTD that will be much more convenient. For example, if the XML pages of the major electronic stores online
Follow the same DTD, then we can easily write an application based on this DTD and go online and grab the things we're interested in automatically. Thing
There are already several well-defined DTDs, such as MathML, SMIL, and so on, as described above.

If an XML file is well-formed, and it is correctly based on a DTD, then this XML file is called: Validating
XML file. The corresponding parser is called: Validating Parser.



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.