OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: XML DTD help for binary data (repost)

[ Lists Home | Date Index | Thread Index ]
  • From: "Rick Jelliffe" <ricko@allette.com.au>
  • To: <xml-dev@ic.ac.uk>
  • Date: Wed, 17 Jun 1998 15:29:12 +1000

> From:  Gang He

> I am working on writing a XML DTD to describe a data file. The file will
> contain some binary data. I understand that I can use Entity and
> Notation to do the job. But for some reason I have to make the file
> containing the binary data a XML document file. Could someone please
> tell me whether I can use PCDATA for the binary data directly or I
> should make all binary characters into character references and then put
> them in PCDATA? And if I need make all binary characters into character
> references first, is there any way to convert the binary character into
> character reference automatically?

An XML text document can only contain characters allowed by the XML spec.

So there are many characters you cannot use: the "function" characters below
&#x20; for example. So even if with numeric character references, XML is not
a format that can be used for direct transmission of binary data. You cannot
put &#x0000; in a document, for example.

You have to encode the binary data in some other notation, and put this
encoded data in the element. (You can mark up which encoding you are using
in an attribute. This may help you if you decide to change notation at some
future time.)

The most common notation to use is Base64. You can find base 64 specified in
an RFC.

You can make a more efficient encoding by using all the available
characters. There are sevearal thousand, so you might want to invent your
own Base4K  encoding, for example, if it was really a big problem.

XML is not a compound document archiving or transmission format.

Rick Jelliffe

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS