Re: [libxml++] derive DomParser Class



On Wed, 2005-05-11 at 15:49 +0200, Virgile Devaux wrote:
> Hi,
> i wanted libxmlpp to return me parse errors as libxml2 wrties it to the
> standard error. For example, when there is a parse error like a
> redefined attributes, all i can see when i catch the exception is
> "Document not well-formed.". It would be interesting to see the same
> message as the one libxml2 outputs to stderr.
> So first i tried by modifiing the libxmlpp fonction parse_context in
> domparser.cc. It works by just always checking errno instead of
> returning when the wellFormed flag is false.
> But to be more clean, i try to create a new class that inherites from
> the DomParser one. As parse_context is a virtual function, all i intend
> to do is to modify the error handling. But i've got the following
> problem: the constructor "Document(_xmlDoc* doc);" (that is used by
> parse_context) of the class Document is private and is only available in
> parse_context because of the "friend class DomParser;" in this class.
> So i can't find a way to do what i want without modifying libxml++
> source code.
> Can anyone gives me a hint about this wanted feature?

Modify libxml++ if you need to, and submit a patch to us. Changing
private stuff to protected would be non-API breaking, so it wouldn't be
a problem.

However, maybe you can just improve the existing DomParser and submit a
patch for that change instead. I'm sure we'd be happy to have more error
details if they exist.

Personally, I avoid the private keyword wherever possible, to avoid
these problems.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com





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