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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: arbitrary bytes/characters?

[ Lists Home | Date Index | Thread Index ]
  • From: John Cowan <cowan@locke.ccil.org>
  • To: Peter.Cardona@usa.xerox.com (Cardona, Peter)
  • Date: Wed, 17 May 100 23:35:33 -0400 (EDT)

Cardona, Peter scripsit:
> 
> 
> All-
> 
> (Sorry if this is a FAQ; I just subscribed to this list and the link to the
> archives on xml.org is broken. I'm also very new to the XML stuff!)
> 
> I'm building a system that needs to deliver arbitrary byte streams and
> descriptions of those streams to client software. Most of the conversations
> between client and server use XML to encode requests and replies. My
> approach was to embed the byte stream inside a CDATA section of an XML
> document. But this appears to be impossible to do reliably:

It's unreliable for other reasons.  Bytes 0x0-0x1F (except CR, LF, TAB)
aren't legal in XML documents at all.  The only safe strategy is to
encode the bytes into characters; Base64 encoding (4 characters for
each 3 bytes) is probably the best option.

If you won't or can't do that:

> 1. The sequence "]]>" may not appear in byte stream, so I'd have to escape
> it with "]]&gt;". That, of course, adds processing time to both the client
> and server in this communication.

Within CDATA sections, "&gt;" isn't understood.  The best approach
is to encode "]]>" as "]]>]]<[!CDATA[>" or the like.
This terminates the CDATA section, provides "]]" as ordinary character
data, and then starts a new CDATA section beginning with ">".

> 2. If the sequence "]]&gt;" were to appear in my byte stream as actual
> content, then what? I don't see a way to escape the escape.

Within a CDATA section, "]]&gt;" represents itself.

-- 
John Cowan                                   cowan@ccil.org
	Yes, I know the message date is bogus.  I can't help it.
		--me, on far too many occasions

***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

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

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