Introduction to XML Beginners

Source: Internet
Author: User
Tags cdata processing instruction

What is XML?
1, full name extensible Markup Language, Extensible Markup Language, the organization published.
2. XML is used to store data with a certain structure relationship.
3, the nesting of tags, is essentially a string of strings.
4. Cross-platform


XML file
1. XML code is stored
2. file suffix named. xml


validating XML files
Using the browser to open and validate the XML file, if it does not conform to the XML syntax specification, will be an error.


XML role
1, to save data
2, as the software configuration file


XML syntax
1. XML Document Declaration
A, used to declare the basic attributes of XML, to command the parsing engine to parse the current XML.
b, usually an XML is included and can contain only one document declaration.
c, the XML document must precede the entire XML and cannot have any content until the document is declared.

D, <?xml version= "1.0"?>Version indicates that the canonical versions that XML follows must be available.

F, <?xml version= "1.0" encoding= "Utf-8"?> used to direct the parsing engine to interpret the XML encoding;
If you save the XML file and parse the XML file using a different encoding, the garbled problem occurs.

D, <?xml version= "1.0" encoding= "Utf-8" standalone= "yes"?>
The standalone property is used to indicate whether the current XML file is a standalone XML, and the default value is "Yes", indicating that the document does not need to be dependent on other documents.

2. Elements
An XML tag is an element;
A label is divided into start and end tags;
The content between the start and end tags becomes the label body;
A label can contain any number of sub-tags, but must be reasonably nested;
Labels that have no label body are called self-closing labels,
For example: <a><a/>, abbreviated to <a/>;
A well-formed XML can have only one root tag;
Naming rules:
Spaces and carriage returns in XML are treated as tag bodies;
The label is case-sensitive;<p></p> and <P></P> are different;
Labels cannot begin with numbers, punctuation marks, or "_";
cannot contain spaces;
The middle of the name cannot contain a colon;

3. Properties
A label can have multiple properties, each name has its name and value;
Format: <china capital= "Beijing" ></china>
The name of the property should also follow the same naming rules as the XML element;
The value of the property needs to be enclosed in double or single quotation marks;
4. Comments
Format:<!--Comments--
Comments can appear anywhere in the document, except before the document Declaration;
Annotations cannot be nested in annotations;

5. CDATA Zone/Escape character
Format: <! [Cdata[Escape Content]]>
CDATA The contents of the area are treated as text;

Escape characters:
Symbol--"escape character"
& &amp;
< &lt;
> &gt;
"-&quot;
'-&apos;

6, processing instructions, referred to as pi (processing instruction)
Used to direct the parsing engine to parse the current XML.

Introduction to XML Beginners

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.