[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: arbitrary bytes/characters?

  • From: John Cowan <cowan@l...>
  • To: Peter.Cardona@u... (Cardona, Peter)
  • Date: Wed, 17 May 100 23:35:33 -0400 (EDT)

peter cardona
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@c...
	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@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.