![]() ![]() ©) or if the XML document encoding does not support the character directly. ![]() This can be useful if you can not type the character (i.e. XML ESCAPE CHARACTERS CODEThe character sequence - is not allowed in a comment.Ĭharacter references allow the character code to be specified within the data instead of the literal character. The -> in the comment can not be escaped, and contains the sequence - which is illegal in a comment. The sequence - may not appear within a comment, no provision is provided for escaping this sequence. When the XML document is parsed ( Character references are not expanded), so any chars within a Comment block are just seen as character data.Īs no escaping is possible within a Comment it is not possible to escape the terminating -> therefore not possible to nest Comment blocks. It is not possible to escape the end sequence of the CDATA block, so the string ]]> can not be stored within it.ĭata within a comment block can not be escaped. When the XML document is parsed ( Character references are not expanded), so any chars within a CDATA block are just seen as character data.Īs no escaping is possible within CDATA it is not possible to escape the terminating ]]> therefore not possible to nest CDATA blocks. The ' and " chars don't need escaping within an elementĭata within a CDATA block can not be escaped. However, it is good practice to escape > chars It is good practice to escape > characters.Ī') are optional, but its good practice to always escape them. The & must always be escaped within attribute data. Typically all the data would be escaped though. However there is no harm in always escaping them.ĪttributeName="She said 'You're right'"ĪttributeName='She said "You're right"'ĪttributeName="She said 'You're right'" The examples can be validated at the W3C Markup Validation Service. The double quotes do not need escaping as they are contained within a single quoted attribute. XML escape characters There are only five: ' " ' ' < < > > & & Escaping characters depends on where the special character is used.The double quotes in the data must be escaped. ![]() The greater than and less than characters do no have to be escaped but its good practice to do it. The ampersand & character must be escaped. When attribute data is enclosed in single quotes ' then any single quote ' characters within the data must be escaped. When attribute data is enclosed in double quotes " then any double quote " characters within the data must be escaped. Element and Attribute names can NOT contain characters "'& escaped or otherwise ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |