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
  http://xmlsoft.org/html/libxml-xmlsave.html

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

more than xmlParseFie (currently I'm using ML_PARSE_NONET |
XML_PARSE_NODICT | XML_PARSE_NOXINCNODE | XML_PARSE_NOBLANKS to turn all
that off).

  Okay

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

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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