W3C home > Mailing lists > Public > www-validator-cvs@w3.org > February 2009

validator/httpd/cgi-bin check,1.645,1.646

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 10 Feb 2009 13:53:03 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LWt2t-0002TO-Ks@lionel-hutz.w3.org>

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv9492

Modified Files:
	check 
Log Message:
XML::LibXML 0.69_2 now has proper error location info

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.645
retrieving revision 1.646
diff -u -d -r1.645 -r1.646
--- check	5 Feb 2009 21:54:08 -0000	1.645
+++ check	10 Feb 2009 13:53:01 -0000	1.646
@@ -713,8 +713,6 @@
         # handle a structured error (XML::LibXML::Error object)
         # (lib XML::LibXML > 0.66, but will work MUCH better > 0.69 )
         push (@xmlwf_obj_error_list, $@);
-        # my $prev_err = $@->_prev();
-        # die($prev_err->{msg});
         my $err_obj = $@;
         while($err_obj->_prev()) {
             $err_obj = $err_obj->_prev();
@@ -725,8 +723,7 @@
             #die($err_obj->dump());
             my $err;
             my $offset;
-            #if($err_obj->int2()) {$offset = $err_obj->int2();} # this should be the location of the column per http://xmlsoft.org/html/libxml-xmlerror.html
-            if ($err_obj->num2()) {$offset = $err_obj->num2();} # this is bogus but seems to be the actual behavior
+            eval {$offset = $err_obj->column()}; # only in XML::LibXML 0.69_2 and above, so wrapping it safely
             $err->{src}  = '...'; # do this with show_open_entities()?
             $err->{line} = $err_obj->line();
             $err->{char} = $offset;
@@ -743,8 +740,7 @@
             $num_xmlwf_error++;
         }
     } 
-    
-    if ($@) {
+    elsif ($@) {
       my $xmlwf_errors = $@;
       my $xmlwf_error_line = undef;
       my $xmlwf_error_col = undef;
Received on Tuesday, 10 February 2009 13:53:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:08 GMT