Talked about some essays on standardized XML document, this we have to continue learning and understanding XML.
A special character and CDATA area
If the XML document contains a number of text characters special characters, such as <or &, and so on, these characters will cause XML documents can be confusing document.
Solutions are as follows:
1. Use entity references: Another special symbols instead of using these special symbols
2. Use CDATA tag: The entire document is defined as a string.
In a particular tag CDATA under all the special characters and even an effective element will be processed as a simple string. Entity references will be useless, into text directly.
CDATA The syntax is as follows:
<! [CDATA [ text]]>
E.g:
<![CDATA][1+3<6]>
Notes Methods in the XML document is fully consistent with the HTML
XML comment syntax is as follows:
<! - Comment string ->
XML comment tag and contains elements allowing, annotation can not be placed before the statement can not be used in a double chain line in the comment, the comment is no longer in vivo use the label, annotation content can not be used "-> " at the end.
Two, XML processing instructions
Acronym PI (processing Instruction). Command parsing engine for processing instructions how to parse XML document content.
XML processing instruction is used to provide information to the application process XML documents, how to tell the handler should parse an XML document, a complete XML document processing program that can read processing instructions XML documents.
XML processing instruction format is as follows:
<? Processing instruction name processing instruction information?>
For example: <? Xml-stylesheet = "text / css" href = "(css style file)"?>
Note here that the label called Chinese, CSS does not work.
Three, XML attributes
XML attribute characteristics:
1.XML attribute element must have an attribute value, the attribute value must be enclosed in quotes.
2. The same XML element can not have multiple attributes of the same name.
No order between 3.XML elements in multiple properties.
to sum up:
1. must have one and only one root element
2. The elements must be reasonable end
3. must be properly nested between elements
4. The properties of the elements must have property values
As long as the above conditions are not satisfied XML document, it shows that it is not a well-formed XML document
As long as that of a well-formed XML document
And compliance with the DTD or schema is a valid XML document.
XML document is a standard structured document, it can be converted into a DOM (Document Object Model) document model tree, which corresponds to the root DOM root of the tree.
Reproduced in: https: //www.cnblogs.com/H_Razor/archive/2011/06/15/xml_03.html