Escape From XML

If you want to use a greater than sign (>) in an XML document you need to escape it. I once had to meticulously look over a 120 MB xml file that was generating a parsing exception, the cause of the exception, a greater than sign. Escape the following characters they are intended as xml/html content.

<	&#60;
> 	&#62;
& 	&#38;

Let me also mention some common characters that I escape when working with HTML.

&#169;     &copy;     Copyright
&#160;     &nbsp;     Space
&#60;      &lt;       <
&#62;      &gt;       >
&#38;      &amp;      &
Enjoy. Share. Be Happy.
  • Twitter
  • Facebook
  • StumbleUpon
  • del.icio.us
  • Tumblr
  • Google Bookmarks
  • FriendFeed
  • Yahoo! Buzz
  • Reddit
  • Digg
  • HackerNews
  • Suggest to Techmeme via Twitter
  • LinkedIn
  • Ping.fm
  • Identi.ca
  • Mixx
  • Furl

Related posts:

  1. CDATA With XSLT
  2. Using Dom4J: Reading An XML File
  3. Using Dom4J: Writing An XML
  4. XML Object Cereal
  5. Yes Comments

This entry was posted in HTML/XML, TechKnow. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*