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"
& &
< <
> >
"-"
'-'
6, processing instructions, referred to as pi (processing instruction)
Used to direct the parsing engine to parse the current XML.
Introduction to XML Beginners