Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control Characters in CDATA

Status
Not open for further replies.

chiph

Programmer
Jun 9, 1999
9,878
US
I've got a requirement to include a MSWord doc in an XML element. The CDATA[] isn't working (SAX chokes on the data). After doing some research, it turns out the W3C says the only characters allowed are Tab (0x09), Carriage Return (0x13), Line Feed (0x0A), and the usual printable Unicode characters.

Has anyone come up with a scheme to get around this?

TIA
Chip H.
 
I've been working on the very same problem the last few days trying to force ^H and ^C out but it turns out that it really is impossible :(

i think that the common method for your problem is to UUEncode the document but obviously this may not be possible.
also depending on your influence over the xml you could design the structure to reference the document externally and then send the doc and the xml as a mime encoded mesg - this would be good if you want to send other media, eg. sound or video.

the only other thing to do is convince someone that word doc is a bad idea and maybe an xhtml doc inside your xml can do the job.

hth.
 
Thanks for the post.

Things aren't looking too good for this feature. We're telling the customer "don't do that", but we'll have to run our own file scrubber to protect ourselves against SAX coughing up a hairball when it sees binary data.

It'd be cool for the next version of XML for them to include a <![BINARY[]]> ability. It'd violate the hell out of the spirit of XML, but sometimes you need that kind of thing.

Chip H.
BTW: the reason why UUEncoding or Base-64 encoding the file is not an option is that the file comes from ordinary people who don't understand that sort of thing (think AOL users).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top