Here is an example of XML file:
<tag value=">this is well formatted xml"/>
This can be loaded successfully in MSXML and Apache Xerces.
<tag value="<this is not"/>
This will failed.
I think the Greater Than sign and Less Than sign are both illegal in the XML file, when they are not being used as tag seperator. But the above example shows the Greater Than sign is ok.
Can anybody explain or give a link to a document about this? Thanks.
Only the characters "<" and "&" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it.
Entity References
Some characters have a special meaning in XML.
If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it as the start of a new element.
This will generate an XML error:
<message>if salary < 1000 then</message>
To avoid this error, replace the "<" character with an entity reference:
<message>if salary < 1000 then</message>
There are 5 predefined entity references in XML:
< < less than
> > greater than
& & ampersand
' ' apostrophe
" " quotation mark
Note: Only the characters "<" and "&" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it.
EDIT 1:
source link http://www.w3schools.com/xml/xml_syntax.asp
you can get more information related to XMl
Example:
Here is what the variable looks like improperly coded in an XML file:
<mail id="a1" to="&<manager>@mycompany.com" …
Here is what the variable looks like properly coded in an XML file:
<mail id="a1" to="&<manager>@mycompany.com" …>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With