|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: arbitrary bytes/characters?
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 "]]>". That, of course, adds processing time to both the client > and server in this communication. Within CDATA sections, ">" 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 "]]>" 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, "]]>" 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








