I'm using Mozilla's JXON code to convert an object to a DOM tree. Then I use XMLSerializer to serialize to text.
var xml = (new XMLSerializer()).serializeToString( JXON.unbuild( object ) );
Works pretty well so far. My problem is that I have a URL as one value. The serializer escapes http://ift.tt/1ue3kVY to http://ift.tt/1ue3kVY which makes it valid, but the server I'm sending this to cannot parse it. It is expecting a CDATA block at this point.
How can I serialize this to "<![CDATA[http://ift.tt/1tMfxEb; instead?
JSFiddle: http://ift.tt/1ue3i0r
EDIT: I fixed my problem another way. Would still be interesting to know if CDATA is possible somehow.
No comments:
Post a Comment