Tutorial by Examples

The & character appears first in entity references and must be escaped in element content or in attribute content. <?xml version="1.0"?> <document attribute="An ampersand is escaped as &"> An ampersand can also be escaped as & in element conte...
The < character appears first in entity tags and must be escaped in element content or in attribute content. <?xml version="1.0"?> <document attribute="A lower-than sign is escaped as <"> 2 + 2 < 5 </document>
The ]]> character sequence is not allowed in element content. The easiest way to escape it is to escape > as >. <?xml version="1.0"?> <document> The sequence ]]> cannot appear in element content. </document>
Attribute values can appear in simple or double quotes. The appropriate character must be escaped. <?xml version="1.0"?> <document quot-attribute="This is a "double quote" and this one is 'simple'" apos-attribute='This is a 'simple quot...
Longer portions of text containing special characters can be escaped with a CDATA section. CDATA sections can only appear in element content. <?xml version="1.0"?> <document> This is a CDATA section : <![CDATA[ plenty of special characters like & < > " ; ...
Characters can be escaped using character references, in element content or attribute values. Their Unicode codepoint can be specified in decimal or hex. <?xml version="1.0"?> <document> The line feed character can be escaped with a decimal (
) or hex (
) ...

Page 1 of 1