Re: [xml] xmlDocDumpMemory and xmlParseMemory

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Wed Nov 08 2000 - 11:31:32 EST


On Wed, Nov 08, 2000 at 11:03:12AM -0500, Matthew Kellett wrote:
>
> Hi,
>
> I've run into an inconsistency between xmlDocDumpMemory and xmlParseMemory
> and I'm wondering if there's another way of doing what I want to do.
>
> I create a tree structure and then save it to memory using
> xmlDocDumpMemory. I then parse it using xmlParseMemory. xmlDocDumpMemory
> seems to add carriage returns '\n' for visual formatting. xmlParseMemory
> interprets these carriage returns as content and create text nodes in the
> new tree with the carriage returns.

  First, which version are you using ? If it's 1.x then upgrade to 2.x.
  Second, did you used xmlKeepBlanksDefault() in any way in your code ?

> I've thought of two workarounds for this. One is to ignore these text
> nodes in the parsed tree. Unfortunately, this adds a level of complexity
> to my code. The other is remove carriage returns from the dumped memory
> block. Unfortunately, this could mean removing significant carriage
> returns, like those in text blocks.

  all blanks are significant. Unless explicitely asked for libxml2
keep all the blanks as text nodes, this is needed for XML compliance.

> Is this expected behaviour? Is there a workaround that won't affect

  No, saving should not add the extraneous formatting space. Unless
you used libxml v1 or explicitely asked to ignore blanks nodes by
using xmlKeepBlanksDefault().

> significant carriage returns? Are these the right functions to use for
> doing this or am I missing something? Any help would be appreciated.

  More information on you setup is really needed for an informed answer.

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | libxml Gnome XML toolkit
Tel : +33 476 615 257  | 655, avenue de l'Europe | http://xmlsoft.org/
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Rpmfind search site
 http://www.w3.org/People/all#veillard%40w3.org  | http://rpmfind.net/
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Nov 08 2000 - 11:46:28 EST