[jdom-interest] CDATA inconsistency
Malachi de AElfweald
malachi at tremerechantry.com
Sun Nov 3 12:04:11 PST 2002
11/3/2002 6:30:33 AM, Elliotte Rusty Harold <elharo at metalab.unc.edu> wrote:
>No, you're not supposed to be able to do that. XML documents are
>based on text, not binary data. There is not even any requirement
>that the underlying representation of the text be binary numbers.
>Words written on paper are perfectly legal XML. So would data in a
>non-binary, analog computer, provided that its representation of text
>adhered to the XML spec.
It is done in many email applications that store inline mime data.
>All text in JDOM is Unicode text. It is not binary data. Changing it
>to a different encoding does not change whether it's legal or not. It
>just changes the binary representation of the text. When adding text
>to an element, for one example, you add a string, not an array of
>bytes.
Using standard HTTP Authentication as an example, you can store the 'authCookie',
in an XML document, even if it contains binary security keys.
for example, when de-encoding the authCookie, you would use something like this.
String usernameAndPwd = new String(new sun.misc.BASE64Decoder().decodeBuffer(authCookie));
Newsgroups and EMail programs regularly represent binary data as text. As such,
there is no reason it shouldn't be valid for XML to contain said data, as long as it
is contained in a CDATA tag.
Malachi
More information about the jdom-interest
mailing list