=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
Not keeping blancs at parsing time or adding some when writing to indent is=
=20
breaking the XML specifications.
However I think it can be usefull to do so. For example in my application I=
do=20
have XML files in which I have no content nodes, and that I have to edit by=
=20
hand. Having them indented automatically is _very_ much easier than to=20
include artificial content nodes. I'm sure I'm not alone in this case.
So I propose to modify the API of libxml to give the possibility not to kee=
p=20
blanks (xmlKeepBlanksDefault option in libxml).
The modification would be the following :
1) add a parameter to parsing functions :
Document* xmlpp::parse_file(const std::string& filename, bool keepblanks =
=3D=20
KeepBlancs::Default) throw(exception)
Document* parse_memory(const std::string& contents, bool keepblanks =3D=20
KeepBlancs::Default) throw(exception);
Document* parse_stream(std::istream& is, bool keepblanks =3D=20
KeepBlancs::Default) throw(exception);
2) add an accessor to Parser :
Parser::set_keepblanks(bool value)
3) add following functions to Document :
Document::write_to_formated_file(const std::string& filename, const=20
std::string& encoding =3D std::string()) throw(exception);
Document::write_to_formated_memory(const std::string& filename, const=20
std::string& encoding =3D std::string()) throw(exception);
The default behavior would remain the same.
Do you agree on this ?
Best regards,
Christophe
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+1K45B+sU3TyOQjARAqnIAJ0bi48MB0JHl0esnr2Qn2zRvQAipgCfR/tO
3MYd6pQpKFNI4iOwKPrZ2p4=3D
=3Dgx4A
=2D----END PGP SIGNATURE-----
|