Re: [xml] xmlKeepBlanksDefault

On Sat, Apr 30, 2011 at 01:29:02PM +0100, Alex Bligh wrote:
I'd like to check my understanding of xmlKeepBlanksDefault.

What I want to do is to make xmlParseFile not generate whitespace nodes
(i.e. I want it to generate the same tree exactly as if no additional
whitespace had been provided), but have xmlSaveFormatFile write
a file out with formatting.

I know I can set XML_PARSE_NOBLANKS in xmlParserOption in xmlReadFile, but
this is not available in xmlParseFile. xmlReadFile also seems to do far

  Use xmlReadFile, it's the modern API for parsing
do not use xmlSaveFormatFile, use the modern APIs for saving from xmlsave

create a saving context, tell it how you want the output.

more than xmlParseFie (currently I'm using ML_PARSE_NONET |
that off).


Setting xmlKeepBlanksDefault to 0 looks promising, and indeed appears
to work. However, the manual page somewhat cryptically says:

 Simpler: "do not use xmlKeepBlanksDefault, it's a global variable"


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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