Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

The designers of XML have saved you from yourself. You aren't even allowed to send formfeed in XML so you are just crazy thinking XML would allow something so insane as sending binary data! Be glad the XML designers had your best interests in mind! If not for their keen insight and concern, you'd be sending binary data already and boy would you soon regret it!

As I note in Re: Funny characters in nodes (exactly zero), Tim Bray declared "XML dislikes [...] form-feed[s] [etc.] which have exactly zero shared semantics from system to system". Yes you'll never find two systems in the world that both use "form feed" to represent a page break.

So you need to either invent your own, proprietary encoding for the binary data and encode the binary data into XML-approved characters (to ensure "shared semantics", oh the irony) and then teach every party involved this new proprietary encoding. Or, you could just find one of the many "XML parsers" (the scare quotes are required by the XML standard) that have the good sense to at least optionally ignore the requirements that they complain about characters that Tim Bray dislikes (something that XML 1.1 will also likely mostly do).

If you can't find such an "XML parser", then you could also just use a simplistic scheme to transform the "not well-formed 'XML'" into XML and then transform all parsed-out values to recover the original binary data. For example, replace any control characters (or other XML-hated characters) and any backslashes with \xx where "xx" is the hex value of the byte (I don't think there are any Unicode characters that XML hates that won't fit in one byte) and then perform the reverse translation on the extracted values.

- tye        


In reply to Re: binary data in XML (semantics) by tye
in thread binary data in XML by sailortailorson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found