Re: [libxml++] writing formatted (indented) files



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Le Vendredi 16 Mai 2003 10:06, Christophe de VIENNE a écrit :
> I want to do a few tests and reproduce the case with pure libxml2.

Playing a bit with xmlKeepBlanksDefault(), xmlSaveFile and xmlSaveFormatFile 
it appeared that my previous observations were partly wrong.

xmlKeepBlanksDefault(0) is _not_ the default, and not what we want as a 
default : it drops and add whitespaces. But I think this option should be 
accessible to the user in a way or another.
So I'm thinking again of adding a per-parser and per-document option, as well 
as a global one, to keep or not blanks.
On the other hand I don't know how this will behave in a multi-threaded 
environnement. So only let the global parameter would be safer. I'll try 
making tests about this.

Anyway we need to remove the calls to xmlKeepBlanksDefault() we actually do.


Cheers

Christophe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+xKmXB+sU3TyOQjARArMPAKDNfS1jBvkZQkogRIx/f+k5dTHyEgCfXI3o
necwR7YrLb1Qe3Zwxb9e7qU=
=A+2j
-----END PGP SIGNATURE-----
#include <libxml/tree.h>

int main()
{
	xmlKeepBlanksDefault(1);
	xmlDocPtr doc;

	doc = xmlParseFile("example.xml");
	if (doc == NULL) return(EXIT_FAILURE);

	xmlSaveFile("no_format.xml", doc);
	xmlSaveFormatFile("format_0.xml", doc, 0);
	xmlSaveFormatFile("format_1.xml", doc, 1);
	xmlSaveFormatFile("format_2.xml", doc, 2);

	xmlFreeDoc(doc);

}



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