RE: [libxml++] writing formatted (indented) files
- From: andy glew amd com
- To: libxmlplusplus-general lists sourceforge net
- Subject: RE: [libxml++] writing formatted (indented) files
- Date: Thu, 8 May 2003 11:48:10 -0700
> Should we elaborate something more sophisticated so the user
> can choose wether the files has to be formatted of not ? I'm not sure it will
> be a frequent need, and if it's really the case, xmlKeepBlanksDefault(1)
> could still be called directly if such a need comes.
I think I need more precise control of indentation
and whitespace significance than this,
and I'm quite happy to roll my own,
but I would appreciate some examples/documentation
as to exactly how to control it.
My biggest concern: I want all whitespace and newlines
to be preserved on input, as is the XML standard.
This probably should be working,
but I haven't been able to get it.
Exactly what is the usage model?
(I'll be perfectly honest: I can't even tell from the name whether
xmlKeepBlanksDefault(0) or 1 preserves whitespace or not. And
brief experiments show no effect. Being anglo-Quebecois, I am
familiar with such Franglais name mapping problems. :-)
E.g. is the value of xmlKeepBlanksDefault sampled and preserved
at the time that an xmlpp::Document is created?
xmlKeepBlanksDefault(0);
xmlpp::DomParser parser0;
xmlKeepBlanksDefault(1);
xmlpp::DomParser parser1;
parser0.parse_file("foo"); // parsed keeping blanks
parser1.parse_file("foo"); // parsed not keeping blanks
Or is it sampled only within the parse routine?
xmlKeepBlanksDefault(0);
xmlpp::DomParser parser00;
xmlpp::DomParser parser01;
xmlKeepBlanksDefault(1);
xmlpp::DomParser parser10;
xmlpp::DomParser parser11;
xmlKeepBlanksDefault(0);
parser00.parse_file("foo"); // parsed keeping blanks
xmlKeepBlanksDefault(0);
parser01.parse_file("foo"); // parsed not keeping blanks
xmlKeepBlanksDefault(0);
parser10.parse_file("foo"); // parsed keeping blanks
xmlKeepBlanksDefault(0);
parser11.parse_file("foo"); // parsed not keeping blanks
... and similarly, possibly, for the print routines.
I.e. is xmlKeepBlanks sampled at object creation time,
or at method invocation time.
Related: is whitespace preservation object oriented, or not?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]