Following characters are special characters in XML.
<, >, Quote, & etc..
XML Entities: < > & "
Replacing above special characters with xml entities is called as encoding.
You can acheive encode in two ways:
1) Best way to encoding is write a text inside PCDATA so parsers treat them accordingly.
2) Write java method will replace special chars with entity chars.
Example:- Code: Select all
<math><![CDATA[a > b ]]></math>