Re: [xml] Indent - please help

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Wed Sep 27 2000 - 18:51:12 EDT


On Wed, Sep 27, 2000 at 06:17:24PM -0300, Nilo S. Mismetti wrote:
>
> I'm using LibXML to parse several documents and works fine.
>
> Now I'm trying to add a new node and works, except that when I save the
> result my additions appears on a single line:
>
> <PosDB><UserID><User01>3,1,86</User01></UserID></PosDB>

  How is that a problem ;-) ?

> To add new nodes <UserID> and <User01> I'm using:
>
> if((curSection=xmlNewChild(BaseSection,NULL,lpAppName,NULL)) == NULL)
> return(0);
> if((curKey=xmlNewTextChild(curSection,NULL,lpKeyName,Valor)) == NULL)
> return(0);
>
> lpAppName == "UserID"
> lpKeyName == "User01"
> Valor == "3,1,86"
>
> To write the XML file I'm using:
>
> xmlIndentTreeOutput=TRUE;
> xmlSetDocCompressMode(doc,CompressLevel);
> return((xmlSaveFile(FileName,doc) == -1) ? TRUE : FALSE);
>
> A little help will be VERY useful.

  All blanks are significant in XML. Hence they are not dropped
at import and not added automatically. You can disable this by using
xmlKeepBlanksDefault(0); but think seriously about it first. The
right solution might be to actually insert the blanks instead
(by adding text nodes containing the formatting).

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
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 Sep 27 2000 - 19:43:46 EDT