5

Is it possible to integrate a real (not encoded in characters) binary block (best with defined byte-order and word-length) into an XML file?

3
  • 2
    Interesting, how would one detect the end of block? Commented Feb 11, 2013 at 17:10
  • 1
    Did you try with a <![CDATA[]]> section? Though I doubt you can have 'real' binary data in it, since XML is basically a text oriented format. Commented Feb 11, 2013 at 17:20
  • 1
    @ThomasMatthews I think the length of the block should be encoded in some attribute. The VTK file format specifications allow something similar. Commented Feb 11, 2013 at 18:08

1 Answer 1

7

No, it is not possible while keeping within the xml standard.

The allowable set of characters in a parsed XML entity is tab, carriage return, linefeed, and valid unicode characters. There are various bytes that fall outside of this allowable range, most prominently 0x0, but also 0x1 - 0x8, 0xB - 0xC, and 0xE - 0x1F (i.e., most values that are classically ASCII control characters).

You can't even include them as numeric entities, since they aren't valid characters. i.e., the following will not validate:

<test>
    Testing ^A: &#x1;
</test>

See http://www.w3.org/TR/2006/REC-xml11-20060816/#charsets

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.