What is XML CDATA? Submission: MDXY-DXY font: [Increase decrease] Type: Reproduced this article mainly for everyone to introduce the next XML CDATA What, learning XML friends can refer to the next
All text in an XML document would be parsed by the parser.
All text in the XML document will be parsed by the parser.
Only text inside a CDATA sections would be ignored by the parser.
Only CDATA Portions of text are ignored by the parser
Parsed Data
Data that is parsed
XML parsers normally parse all the text of an XML document.
XML parsers usually parse all the text in an XML document
Parsing data
The XML parser typically processes all the text in an XML document.
When the XML element is parsed, the text inside the XML element is also parsed:
<message>this text is also parsed</message>
The XML parser does this because the XML element may also contain other elements, as in the following example, the name element contains the first and last two elements inside:
<name><first>Bill</first><last>Gates</last></name>
The parser will assume that the above code is this:
?
1234 |
< name > < first >Bill</ first > < last >Gates</ last > </ name > |
Escape character
An illegal XML character must be replaced with the corresponding entity.
If you use a character like "<" in an XML document, the parser will get an error because the parser will assume that this is the beginning of a new element. Therefore, you should not write the code as follows:
<message>if Salary < Then</message>
To avoid this, the character "<" must be converted to an entity, as follows:
<message>if Salary < Then</message>
Here are five pre-defined entities in the XML document:
< |
< |
Less than sign |
> |
> |
Greater than sign |
& |
& |
And |
‘ |
‘ |
Single quotation marks |
" |
" |
Double quotes |
The entity must begin with the symbol "&", with the symbol ";" End.
Note: Only the "<" character and the "&" character are strictly forbidden for XML. The rest is legal, and the use of entities is a good habit in order to reduce errors.
CDATA Parts
All content inside CDATA is ignored by the parser.
If the text contains a lot of "<" characters and "&" characters-just like the program code-it's best to put them all in a CDATA widget.
A CDATA part to "<! The [cdata[] tag begins with the "]]>" Mark:
?
123456789101112131415 |
< script > <![CDATA[ function matchwo(a,b) { if (a < b && a < 0) then { return 1 } else { return 0 } } ]]> </ script > |
In the previous example, all the text between the CDATA parts is ignored by the parser.
CDATA Considerations:
A CDATA part (not nested) can no longer be included between 1.CDATA parts. If the CDATA part contains the character "]]>" or "<! [cdata[], will be very likely to make mistakes oh.
2. Also note that there is no space or line break between the string "]]>".
<! What does [cdata[]]> mean???
=================================================
Marked as plain text, without this word < > & characters cannot be stored directly in XML, they need to be escaped, and this tag does not need to be escaped and the symbols are stored in an XML document.
You can avoid unexpected special symbols that result in XML parsing errors.
C # involves questions about XML CDATA and validation validity
I was just beginning to learn something about XML, in which I met a section called CDATA. The explanation here is that everything in CDATA will be ignored by the parser. I don't know what that means. In simple terms, CDATA when to use, what's the use of this stuff. If you use this, it will produce a result of what it looks like.
There is also validation of XML validation. What is the meaning of this, why to verify the validity, how to verify the general, method how? I read that there are two methods of DTD and XML schema, how to use, what is the difference?
The problem is a little bit more, but it is two major problems. Want to know the heroes help younger brother, with a simple word to tell me. Thank you very much.
==================================================
When you use Flash and XML to do Web site applications, such as giving people the freedom to enter names, people can enter some symbols, such as: "<", ">", "/", "?" "And so on, when the XML is generated, the XML structure is broken and the data is interrupted.
This is going to use XML CDATA
All text in the XML document will be parsed by the parser.
Only text within a CDATA part is ignored by the parser.
<! What does [cdata[]]> mean? ~
Read data from the database to generate an XML file, add a "<! What does [cdata[]]>] mean?
Response.Write "<body><! [cdata[]
Response.Write RS ("message")
Response.Write "]]></body>"
============================================
Marked as plain text, without this word < > & characters cannot be stored directly in XML, they need to be escaped, and this tag does not need to be escaped and the symbols are stored in an XML document.
You can avoid unexpected special symbols that result in XML parsing errors.
What is the difference between Pcdata and CDATA?
=============================================
Pcdata represents the parsed character data.
CDATA is text that is not parsed by the parser, and the labels in the text are not considered tokens.
CDATA Indicates what is inside the data XML is not parsed. For example, maybe the following paragraph
?
123456 |
<![CDATA[ if(a>b){ System.out.println(a); } ]]> |
Notice one of the ">" symbols above.
Pcdata data is to the XML parser to parse, the top of the "parse" must be wrong, so to use the entity definition. The above data is indicated by Pcdata as follows:
if (a>b) {
System.out.println (a);
}
CDATA is a keyword used in an XML document that tells the browser that this part is not parsed and is intended for other applications, such as JavaScript, #PCDATA是在 XML constraint documents, such as DTD-type constraint documents. In this case, the contents of the element or the value range of the property, etc., are in the form of a string
What is XML CDATA?