[libxml++] keek blancs.



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

Hi,

Not keeping blancs at parsing time or adding some when writing to indent is 
breaking the XML specifications.
However I think it can be usefull to do so. For example in my application I do 
have XML files in which I have no content nodes, and that I have to edit by 
hand. Having them indented automatically is _very_ much easier than to 
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 keep 
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 = 
KeepBlancs::Default) throw(exception)
Document* parse_memory(const std::string& contents, bool keepblanks = 
KeepBlancs::Default) throw(exception);
Document* parse_stream(std::istream& is, bool keepblanks = 
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 
std::string& encoding = std::string()) throw(exception);
Document::write_to_formated_memory(const std::string& filename, const 
std::string& encoding = std::string()) throw(exception);


The default behavior would remain the same.

Do you agree on this ?


Best regards,


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

iD8DBQE+1K45B+sU3TyOQjARAqnIAJ0bi48MB0JHl0esnr2Qn2zRvQAipgCfR/tO
3MYd6pQpKFNI4iOwKPrZ2p4=
=gx4A
-----END PGP SIGNATURE-----





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