- From: <bugzilla@wiggum.w3.org>
- Date: Wed, 31 Dec 2008 20:36:49 +0000
- To: www-validator-cvs@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=6329
--- Comment #9 from Olivier Thereaux <ot@w3.org> 2008-12-31 20:36:49 ---
(In reply to comment #8)
> I think I found the culprit in the Changelog for XML::LibXML. In recent
> versions, there is a new module to use the Structured Errors API (great!) but
> it's not quite backward compatible.
>
> Will have to add code to handle the Structured Errors.
> http://search.cpan.org/~pajas/XML-LibXML-1.69/lib/XML/LibXML/Error.pod
The frustrating part so far is that the new structured errors code only gives
you the last parsing error (when, if anything, I would be happy enough showing
only the first!)
Using this code, from the perl module documentation:
use 5.008; use strict; use warnings; use utf8; use XML::LibXML qw();
my $dotted=XML::LibXML::LIBXML_DOTTED_VERSION;
print "XML::LibXML Version: $XML::LibXML::VERSION\nlibxml2 Version:
$dotted\n\n";
eval {XML::LibXML->new()->parse_string('<foo attr1="value1"attr2="value2"
/>')};
if (ref($@)) {
# handle a structured error (XML::LibXML::Error object)
print $@->dump();
} elsif ($@) {
# error, but not an XML::LibXML::Error object
print $@;
} else {
# no error
}
ot@qa:~$ perl testlibxml.pl
XML::LibXML Version: 1.66
libxml2 Version: 2.6.32
:1: parser error : attributes construct error
<foo attr1="value1"attr2="value2" />
^
:1: parser error : Couldn't find end of Start Tag foo line 1
<foo attr1="value1"attr2="value2" />
^
:1: parser error : Extra content at the end of the document
<foo attr1="value1"attr2="value2" />
^ at testlibxml.pl line 6
ot@qa:~$ perl testlibxml.pl
XML::LibXML Version: 1.69
libxml2 Version: 2.6.32
$error = bless( {
'num1' => 0,
'file' => '',
'message' => 'Extra content at the end of the document
',
'domain' => 1,
'level' => 3,
'str2' => undef,
'_prev' => undef,
'str1' => undef,
'str3' => undef,
'num2' => 11,
'code' => 5,
'line' => 1
}, 'XML::LibXML::Error' );
Maybe I'm doing it wrong? The documentation is scarce, might need to contact
the developer(s) to get some clearer answers.
--
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Wednesday, 31 December 2008 20:36:58 UTC