Evan Martin (evan) wrote in lj_dev,
Evan Martin
evan
lj_dev

  • Music:
So I'd like to save/restore journal entries to/from XML, but I've a dilemma:
Entries can have lots of crazy mismatched < and > HTML tags in them. That's fine; we can just wrap all of that data in the <![CDATA[ ]]> tag.
But then, what if someone writes a post about XML? Or they somehow manage to use the the magic string "]]>" at all?

There are two solutions, as I see it:
- I can urlencode the entire post. This is ugly, and reduces readability of the XML.
- I can somehow escape the important characters, via XML entities.

And with that second solution, I get to the point: what is the standard/proper way to do this with XML? Which entities are defined/what needs to be escaped?
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments