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



Le Jeudi 8 Mai 2003 14:32, Murray Cumming Comneon com a écrit :
> > From: Christophe de Vienne [mailto:cdevienne alphacent com]
> > Sent: Donnerstag, 8. Mai 2003 14:25
> > To: libxmlplusplus-general lists sourceforge net
> > Subject: Re: [libxml++] writing formatted (indented) files
> >
> > Le Jeudi 8 Mai 2003 14:13, Christophe de Vienne a écrit :
> > > So we could call it in Document::Init::Init() and remove it
> >
> > everywere else.
> >
> > I've done that and it's working well.
> > Since the behavior is more consistent like this I'll commit
> > the patch in a few
> > minutes.
>
> Hold on. Be careful. Isn't xmlKeepBlanksDefault() all about breaking the
> XML specification for libxml backwards compatibility:
> http://xmlsoft.org/html/libxml-parser.html#xmlKeepBlanksDefault
>
> I thought we had already chosen the correct use of it.

I see. The confusion comes from the fact that I was looking at the parse_xxx 
functions which are inside document.cc, which does a xmlKeepBlanksDefault(0).
The parsing methods in SaxParser and DomParser does the right thing.

I propose to take them off since they are not behaving consistently with what 
Parsers do.

Anyway it seems that  xmlKeepBlanksDefault(0) is not the default inside 
libxml2, since without calling it the output is not formatted.
One solution would be to do in Document what we to in Parser : define a 
constant we use in write_to_xx and then restore the previous value.

Talking about this : the Parsers do a call to 
xmlKeepBlanksDefault(CONSTANT_KeepBlanksSetting), but there is no way for the 
user to change the value.
Wouldn't be better to add a function to Parser which change it (and do the 
same with Document) ? A document generated from a parser would take the same 
value for this parameter than the parser.


Christophe




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