summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xhtdocs/docs/install.html6
-rwxr-xr-xhttpd/cgi-bin/check172
-rw-r--r--misc/bundle/META.yml2
-rw-r--r--misc/bundle/Makefile.PL2
-rw-r--r--misc/bundle/lib/Bundle/W3C/Validator.pm2
5 files changed, 29 insertions, 155 deletions
diff --git a/htdocs/docs/install.html b/htdocs/docs/install.html
index 48a91da..75397c7 100755
--- a/htdocs/docs/install.html
+++ b/htdocs/docs/install.html
@@ -1,5 +1,5 @@
-<!--#set var="revision" value="\$Id: install.html,v 1.59 2010-03-03 19:13:29 ville Exp $"
---><!--#set var="date" value="\$Date: 2010-03-03 19:13:29 $"
+<!--#set var="revision" value="\$Id: install.html,v 1.60 2010-03-03 19:40:59 ville Exp $"
+--><!--#set var="date" value="\$Date: 2010-03-03 19:40:59 $"
--><!--#set var="title" value="Installation Documentation for The W3C Markup Validation Service"
--><!--#set var="relroot" value="../"
--><!--#include virtual="../header.html" -->
@@ -180,7 +180,7 @@ install Bundle::W3C::Validator
<dd>
Library to handle URIs and escaping special characters in them.
</dd>
- <dt><a href="http://search.cpan.org/dist/XML-LibXML/">XML-LibXML</a> &gt;= 1.56</dt>
+ <dt><a href="http://search.cpan.org/dist/XML-LibXML/">XML-LibXML</a> &gt;= 1.69</dt>
<dd>
The Perl binding for libxml2, used to check the syntax of XML-based document types.
</dd>
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check
index ddac822..a65f77a 100755
--- a/httpd/cgi-bin/check
+++ b/httpd/cgi-bin/check
@@ -14,7 +14,7 @@
# This source code is available under the license at:
# http://www.w3.org/Consortium/Legal/copyright-software
#
-# $Id: check,v 1.768 2010-03-03 19:13:29 ville Exp $
+# $Id: check,v 1.769 2010-03-03 19:40:59 ville Exp $
#
# We need Perl 5.8.0+.
@@ -61,7 +61,7 @@ use JSON 2.00 qw();
use SGML::Parser::OpenSP 0.991 qw();
use URI qw();
use URI::Escape qw(uri_escape);
-use XML::LibXML 1.56 qw(); # Need 1.56 for line_numbers()
+use XML::LibXML 1.69 qw(); # Need 1.69 for (working) structured errors
###############################################################################
#### Constant definitions. ####################################################
@@ -191,7 +191,7 @@ EOF
#
# Strings
- $VERSION = q$Revision: 1.768 $;
+ $VERSION = q$Revision: 1.769 $;
$VERSION =~ s/Revision: ([\d\.]+) /$1/;
# Read friendly error message file
@@ -634,152 +634,33 @@ if (&is_xml($File)) {
eval { $xmlparser->parse_string($xml_string); };
$xml_string = undef;
- my $xml_parse_errors_line = undef;
- my @xmlwf_error_list;
- if (ref($@)) {
+ my $err_obj = $@;
+ while ($err_obj) {
+ my $err;
+ $err->{src} = '...'; # do this with show_open_entities()?
+ $err->{line} = $err_obj->line();
- # handle a structured error (XML::LibXML::Error object)
- # (lib XML::LibXML > 1.66, but will work MUCH better with > 1.69)
+ # -> column() is available in XML::LibXML >= 1.69_2
+ $err->{char} = eval { $err_obj->column() };
+ $err->{num} = "libxml2-" . $err_obj->code();
+ $err->{type} = "E";
+ $err->{msg} = $err_obj->message();
- my $err_obj = $@;
- my $num_xmlwf_error = 0;
- while ($err_obj) {
- my $err;
- $err->{src} = '...'; # do this with show_open_entities()?
- $err->{line} = $err_obj->line();
+ $err_obj = $err_obj->_prev();
- # -> column() is available in XML::LibXML >= 1.69_2
- $err->{char} = eval { $err_obj->column() };
- $err->{num} = "libxml2-" . $err_obj->code();
- $err->{type} = "E";
- $err->{msg} = $err_obj->message();
-
- $err_obj = $err_obj->_prev();
-
- # The validator will sometimes fail to dereference entities
- # files; we're filtering the resulting bogus error for
- # non-standalone documents. @@@TODO: is this still needed?
- if (!$standalone &&
- $err->{msg} =~ /Entity '\w+' not defined/)
- {
- $err = undef;
- next;
- }
-
- unshift(@xmlwf_error_list, $err);
- $num_xmlwf_error++;
+ # The validator will sometimes fail to dereference entities
+ # files; we're filtering the resulting bogus error for
+ # non-standalone documents. @@@TODO: is this still needed?
+ if (!$standalone &&
+ $err->{msg} =~ /Entity '\w+' not defined/)
+ {
+ $err = undef;
+ next;
}
- }
- elsif ($@) {
- my $xmlwf_errors = $@;
- my $xmlwf_error_line = undef;
- my $xmlwf_error_col = undef;
- my $xmlwf_error_msg = undef;
- my $got_error_message = undef;
- my $got_quoted_line = undef;
- my $num_xmlwf_error = 0;
- foreach my $msg_line (split "\n", $xmlwf_errors) {
-
- $msg_line =~ s{[^\x0d\x0a](:\d+:)}{\n$1}g;
- $msg_line =~ s{[^\x0d\x0a]+[\x0d\x0a]$}{};
-
- # first we get the actual error message
- if (!$got_error_message &&
- $msg_line =~ /^(:\d+:)( parser error : .*)/)
- {
- $xmlwf_error_line = $1;
- $xmlwf_error_msg = $2;
- $xmlwf_error_line =~ s/:(\d+):/$1/;
- $xmlwf_error_msg =~ s/ parser error :/XML Parsing Error: /;
- $got_error_message = 1;
- }
-
- # then we skip the second line, which shows the context
- # (we don't use that)
- elsif ($got_error_message && !$got_quoted_line) {
- $got_quoted_line = 1;
- }
- # we now take the third line, with the pointer to the error's
- # column
- elsif (($msg_line =~ /(\s+)\^/) and
- $got_error_message and
- $got_quoted_line)
- {
- $xmlwf_error_col = length($1);
- }
-
- # cleanup for a number of bugs for the column number
- if (defined($xmlwf_error_col)) {
- if (( my $l =
- length($File->{Content}->[$xmlwf_error_line - 1])
- ) < $xmlwf_error_col
- )
- {
-
- # http://bugzilla.gnome.org/show_bug.cgi?id=434196
- #warn("Warning: reported error column larger than line length " .
- # "($xmlwf_error_col > $l) in $File->{URI} line " .
- # "$xmlwf_error_line, libxml2 bug? Resetting to line length.");
- $xmlwf_error_col = $l;
- }
- elsif ($xmlwf_error_col == 79) {
-
- # working around an apparent odd limitation of libxml
- # which only gives context for lines up to 80 chars
- # http://www.w3.org/Bugs/Public/show_bug.cgi?id=4420
- # http://bugzilla.gnome.org/show_bug.cgi?id=424017
- $xmlwf_error_col = "> 80";
-
- # non-int line number will trigger the proper behavior
- # in report_error
- }
- }
-
- # when we have all the info (one full error message), proceed
- # and move on to the next error
- if ((defined $xmlwf_error_line) and
- (defined $xmlwf_error_col) and
- (defined $xmlwf_error_msg))
- {
-
- # Reinitializing for the next batch of 3 lines
- $got_error_message = undef;
- $got_quoted_line = undef;
-
- # formatting the error message for output
- my $err;
- $err->{src} = '...'; # do this with show_open_entities()?
- $err->{line} = $xmlwf_error_line;
- $err->{char} = $xmlwf_error_col;
- $err->{num} = 'xmlwf';
- $err->{type} = "E";
- $err->{msg} = $xmlwf_error_msg;
-
- # The validator will sometimes fail to dereference entities
- # files; we're filtering the resulting bogus error for
- # non-standalone documents. @@@TODO: is this still needed?
- if (!$standalone &&
- $err->{msg} =~ /Entity '\w+' not defined/)
- {
- $xmlwf_error_line = undef;
- $xmlwf_error_col = undef;
- $xmlwf_error_msg = undef;
- next;
- }
- push(@xmlwf_error_list, $err);
- $xmlwf_error_line = undef;
- $xmlwf_error_col = undef;
- $xmlwf_error_msg = undef;
- $num_xmlwf_error++;
-
- }
- }
- }
- foreach my $errmsg (@xmlwf_error_list) {
$File->{'Is Valid'} = FALSE;
- push @{$File->{WF_Errors}}, $errmsg;
+ unshift(@{$File->{WF_Errors}}, $err);
}
}
}
@@ -970,13 +851,6 @@ if ($File->{Opt}->{Output} eq 'json') {
for my $key (qw(msg expl)) {
$msg->{$key} = $json->encode($msg->{$key}) if $msg->{$key};
}
-
- # Drop non-numeric char indicators from output, e.g.
- # "> 80" for some XML parse error ones (see the non-structured
- # XML::LibXML code branch in XML preparsing below).
- if ($msg->{char} && $msg->{char} !~ /^\d+$/) {
- delete($msg->{char});
- }
}
}
}
diff --git a/misc/bundle/META.yml b/misc/bundle/META.yml
index af3782e..632c198 100644
--- a/misc/bundle/META.yml
+++ b/misc/bundle/META.yml
@@ -34,7 +34,7 @@ requires:
Socket: 0
URI: 0
URI::Escape: 0
- XML::LibXML: 1.56
+ XML::LibXML: 1.69
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.3.html
version: 1.3
diff --git a/misc/bundle/Makefile.PL b/misc/bundle/Makefile.PL
index 311b1a1..279c432 100644
--- a/misc/bundle/Makefile.PL
+++ b/misc/bundle/Makefile.PL
@@ -37,7 +37,7 @@ WriteMakefile(
"Socket" => 0,
"URI" => 0,
"URI::Escape" => 0,
- "XML::LibXML" => 1.56,
+ "XML::LibXML" => 1.69,
# Optional:
"Encode::JIS2K" => 0,
diff --git a/misc/bundle/lib/Bundle/W3C/Validator.pm b/misc/bundle/lib/Bundle/W3C/Validator.pm
index 43163cb..ac096de 100644
--- a/misc/bundle/lib/Bundle/W3C/Validator.pm
+++ b/misc/bundle/lib/Bundle/W3C/Validator.pm
@@ -47,7 +47,7 @@ C<perl -MCPAN -e "install Bundle::W3C::Validator">
Socket
URI
URI::Escape
- XML::LibXML 1.56
+ XML::LibXML 1.69
=head1 DESCRIPTION