Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 11th, 2004, 11:20 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Compressed XML in DOM

Hi,
 I am looking to compress a particular node in an XML. Other parts of the XML need to be unaltered and I am getting all the XML within the node in a string, using zlib to compress the string, and adding the compressed string to the node again. But when I try to load this compressed XML in to the DOM again it complains about invalid characters in input. Has someone ever done this or is there a proper solution to this? Thanks in advance.

Sam.

 
Old April 11th, 2004, 03:31 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You need to save the resulting compressed stream within a CDATA section so the XML parser ignores it.

<compressedNode>
   <![CDATA[compressed data goes here]]>
</compressedNode>

Take a look at this article for more details.

Peter
-------------------------
Work smarter, not harder
 
Old April 11th, 2004, 06:18 PM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Peter. Actually I hadn't mentioned that the characters, after compression are looking obscure and I don't know how to handle those. (something like this: ÝZ¥ïa®÷YLœãPŸèT¢îOê etc.) The whole XML is enclosed within a CDATA and still the DOM complains. Any ideas?

Quote:
quote:Originally posted by planoie
 You need to save the resulting compressed stream within a CDATA section so the XML parser ignores it.

<compressedNode>
<![CDATA[compressed data goes here]]>
</compressedNode>

Take a look at this article for more details.

Peter
-------------------------
Work smarter, not harder





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing xml using DOM balarkavelidi XML 1 January 31st, 2006 10:28 PM
XML DOM / ASP 3.0 xica XML 1 July 13th, 2004 12:23 AM
Loop in XML DOM? omallec XML 3 November 27th, 2003 09:16 AM
XML DOM with JScript --- PLEASE HELP!!! bebe XML 4 October 1st, 2003 11:40 AM
XML DOM and Javascript lilu XML 3 September 25th, 2003 07:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.