[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-xml
Subject:    Re: getting better diagnostics out of RelaxNG
From:       Petr Pajas <pajas () ufal ! ms ! mff ! cuni ! cz>
Date:       2004-05-24 8:50:40
Message-ID: v7kvfim5hun.fsf () sup ! ms ! mff ! cuni ! cz
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

Content-Transfer-Encoding: quoted-printable

Larry Siden <lsiden@comcast.net> writes:

> Does anyone know how to get more descriptive error messages out of
> XML::LibXML::RelaxNG?  When it parses the schema, it generates the
> message "Element or text conflicts in interleave", but it doesn't give
> me any line number or element name.  When the schema was slightly
> different, it complained "expecting , got nothing".  Isn't there a way
> to get better error messages so that I can pinpoint the problem?
>
> -Larry Siden

This one is tough. Since 2.6, libxml2 supports a new error handling
scheme, with structured error messages, which is a good news. The bad
news is, that since 2.6, the old messages often don't provide enough
information. I'm working on the new error messages support for
XML::LibXML. Most of the code is already written and functional in a
CVS branch called structerror. It requires to be compiled with

 perl Makefile.PL WITH_SERRORS=1

Everything else should work as before, except that

1) LibXML uses the new error handling API of libxml2

2) error messages in $@ are actually XML::LibXML::Error objects, so
   you can retrieve specific information from them

3) $@ automatically serializes to a string forming identical messages
   to the old ones (except that this time the messages should contain
   all the information you ask for).

There is no need to change any existing code.

There are two pending things which need to be solved before the code
is ready to go into a CPAN distro and officially replaces the old one:

a) there are several spots in libxml2 where structured errors are not
   reported correctly (few XPath related errors). I reported this, but
   Daniel probably put this off his mind, so I need to bugzilla these.

b) some tests need to be written: t/XYerror.t

c) no documentation so far

d) port this to XML::LibXSLT and XML::LibXML::XPathContext (I'm almost
   ready with the later), so that all these modules behave in the same
   way.

It needs some time to finish which I have little these days. In the
meantime, it would be very helpful if you could test the CVS
structerror branch, try your code with it and report all problems you
can find:-)

Thanks,

-- Petr

[Attachment #5 (application/pgp-signature)]

_______________________________________________
Perl-XML mailing list
Perl-XML@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic