RE: [xml] xmlDocDumpFormatMemory problem?



Thanks for the message, Igor. Yes, I was expecting to have the output as you
showed. 

Now I understand the reason. However, if the parties using the their XML
document agree upon the indentation, there will be no confusion on how to
interpret the data. Is there any handy tools for pre/post-processing XML
document, so that "insignificant" spaces could be eliminated? 

Thanks. 

Gang Wang 
-----Original Message-----
From: Igor Zlatkovic [mailto:igor stud fh-frankfurt de]
Sent: Tuesday, June 25, 2002 3:47 AM
To: Gang Wang; xml gnome org
Subject: Re: [xml] xmlDocDumpFormatMemory problem?


Hi there,

xmlKeepBlanksDefault(0);
xmlDocDumpFormatMemory(xmlDoc, &buf, &size, 1);

The data both of them send out looks as following:
<?xml version="1.0"?>
<test><a>data</a>hello world</test>

I assume that you have expected something like:

  <?xml version="1.0"?>
  <test>
    <a>
      data
    </a>
    hello world
  </test>

right? All novices who use XML for trivial purposes expect 
such behaviour.
Forget it. I hope it is clear that the document I displayed 
here is not the
same as the one you displayed. My document's text nodes have 
additional
characters, namely spaces and newlines. These are not the 
part of the data,
but have been introduced by the indenting engine. 
Unfortunately, exactly
that information is missing in the resulting document--one 
cannot tell which
of these characters are data and which are just a formatting. When one
parses my document back, one gets a different DOM than was 
the original.

There is no way to make a difference between the whitespace and the
ignorable whitespace in text nodes. All you can do is guess, 
and whenever
the software guesses, it guesses wrong. For that reason, no 
formatting is
performed on nodes which contain text children.

I have tested version 2.4.21 on RedHat linux and also the 
windows versions
2.4.21 and 2.4.22 posted by Igor Zlatkovic on his web site. 
They behaved
the
same.

That is good, they should behave the same.

Ciao
Igor


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]