Re: [Re: [Re: [libxml++] Validation implemented]]



Stefan Seefeld <seefeld sympatico ca> wrote:
> Murray Cumming wrote:
> 
> >>another worthy addition would be to have all dom modification methods
> >>(Node::insert() et al.) validate. So an attempt to remove a node or to
> >>add one could be refused. That doesn't actually seem to be hard, as 
> >>libxml2 provides functions to validate individual nodes (subtrees ?)...
> > 
> > 
> > Yes, that would be nice.
> 
> How would the API look like ?

The same as now, but those methods would throw validation_errors.

> Should validation be on for parsing / dom
> manipulation whenever a dtd is attached to the document and ommitted if
> not ?

At the moment parsing is off by default which kind of solves that problem.

> Alternatively, should the document have a flag indicating whether
> modifications should be audited ?

No, I think it's fine to allow the user to turn validation on or off in
general whenever they like.

> Or should each modifying call get an additional bool parameter to
> indicate 'do validate' ?

No, see above.

> I guess we all agree that the last is not really an option. I tend to
> think that the first (validate whenever a dtd is present) is best, at
> least as the default behavior, while a 'suppress_validation()' method
> could be used if the user wants not to validate.

We would need some code to test whether a DTD is present - then maybe it would
be a good idea. However, maybe it's not a good idea for our "default" to
change implicitly depending on the contents of the document.


Murray Cumming
murrayc usa net
www.murrayc.com





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