Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^4: binary data in XML (CDATA, ha!)

by Fletch (Bishop)
on Feb 28, 2008 at 19:08 UTC ( #670987=note: print w/replies, xml ) Need Help??

in reply to Re^3: binary data in XML (CDATA, ha!)
in thread binary data in XML

Perhaps I was a little unclear, so for the benefit of the slow, I was offering two alternatives:

  • Use CDATA if you've got character data that otherwise would be interpreted as markup and don't mind the onerous task of encoding the commonly appearing sequence "]]>" instead of encoding every other offending single character individually (say you had Perl code which was otherwise free of verboten characters but chock full of > and < etc)
  • Use an out-of-band encoding such as base64 which is handled at the application layer rather than by the XML parser itself for what would otherwise be invalid character data (a sequence of octets which would be outside XML's allowed range when interpreted)

Given that there was no example of what exactly the offending "binary data" was I thought it best to offer both options: the simple for more vanilla ASCII-y data and encoding for arbitrary octet streams.

Update: Further clarified what types of data suggest which alternative.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://670987]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (1)
As of 2023-10-03 00:49 GMT
Find Nodes?
    Voting Booth?

    No recent polls found