Re: [xml] xmlDocDumpMemory and xmlParseMemory

Date view Thread view Subject view Author view

From: Matthew Kellett (matthewk@rebel.com)
Date: Wed Nov 08 2000 - 11:50:33 EST


Sorry, I should have mentioned that.

I was using libxml 2.2.2 and have moved to libxml 2.2.7, with no effect.

I do not use xmlKeepBlanksDefault() anywhere in my code.

I've walked through the functions used by xmlDocDumpMemory and there seems
to be an explicit addition of carriage returns in each one. The
xmlDumpNode* functions seem to have a switch for formatting but it isn't
brought out to the level of xmlDocContentDump() or xmlDocDumpMemory() It
would be nice to have a switch to turn this formatting off.

Cheers,
Matthew

At 11:31 AM 2000/11/08, you wrote:

>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

----
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 - 12:45:05 EST