diff options
author | ville <ville@localhost> | 2009-12-14 21:18:33 +0000 |
---|---|---|
committer | ville <ville@localhost> | 2009-12-14 21:18:33 +0000 |
commit | 875610b765ed858c21bb0ff0d041758610b1f122 (patch) | |
tree | d77704068dc91156c93f84b39213ee590a12793b | |
parent | 2b1246e03c2cb1ea40c8fa61dec784b5d973bb92 (diff) | |
download | markup-validator-875610b765ed858c21bb0ff0d041758610b1f122.zip markup-validator-875610b765ed858c21bb0ff0d041758610b1f122.tar.gz markup-validator-875610b765ed858c21bb0ff0d041758610b1f122.tar.bz2 |
Do not filter out undefined entity errors for standalone XML docs (#7007).
-rwxr-xr-x | htdocs/whatsnew.html | 9 | ||||
-rwxr-xr-x | httpd/cgi-bin/check | 27 |
2 files changed, 28 insertions, 8 deletions
diff --git a/htdocs/whatsnew.html b/htdocs/whatsnew.html index c36f4ef..92ee09b 100755 --- a/htdocs/whatsnew.html +++ b/htdocs/whatsnew.html @@ -1,5 +1,5 @@ -<!--#set var="revision" value="\$Id: whatsnew.html,v 1.92 2009-12-12 11:15:12 ville Exp $" ---><!--#set var="date" value="\$Date: 2009-12-12 11:15:12 $" +<!--#set var="revision" value="\$Id: whatsnew.html,v 1.93 2009-12-14 21:18:33 ville Exp $" +--><!--#set var="date" value="\$Date: 2009-12-14 21:18:33 $" --><!--#set var="title" value="What's New at The W3C Markup Validation Service" --><!--#set var="relroot" value="./" --><!--#set var="feeds" value="1" @@ -158,6 +158,11 @@ lines longer than 4k bytes</a> could not be processed. </li> <li> + Bug fix: an error was not issued for + <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=7007">standalone + XML documents containing external entities</a>. + </li> + <li> Dependency changes: new dependency: JSON >= 2.00; new minimum required versions: libwww-perl 5.802, Config-General 2.32, SGML-Parser-OpenSP 0.991; String-Approx is no longer required. diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check index 91adf57..a332c29 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.752 2009-12-14 20:44:49 ville Exp $ +# $Id: check,v 1.753 2009-12-14 21:18:33 ville Exp $ # # We need Perl 5.8.0+. @@ -197,7 +197,7 @@ EOF # # Strings - $VERSION = q$Revision: 1.752 $; + $VERSION = q$Revision: 1.753 $; $VERSION =~ s/Revision: ([\d\.]+) /$1/; # Read friendly error message file @@ -627,6 +627,15 @@ if (&is_xml($File)) { ([^>].*\?>) /$1encoding="UTF-8"$4/sx; + # Is the document standalone? Need to check with a regex because + # the parser may fail to return a document we could use for this. + my $standalone = ( + $xml_string =~ /^<\?xml\b[^>]*[\x20\x09\x0D\x0A] + standalone[\x20\x09\x0D\x0A]*=[\x20\x09\x0D\x0A]* + (["'])yes\1 + /sx + ); + eval { $xmlparser->parse_string($xml_string); }; $xml_string = undef; my $xml_parse_errors_line = undef; @@ -656,8 +665,11 @@ if (&is_xml($File)) { $err->{msg} = $err_obj->message(); # The validator will sometimes fail to dereference entities - # files; we're filtering the resulting bogus error - if ($err->{msg} =~ /Entity '\w+' not defined/) { + # 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; } @@ -752,8 +764,11 @@ if (&is_xml($File)) { $err->{msg} = $xmlwf_error_msg; # The validator will sometimes fail to dereference entities - # files; we're filtering the resulting bogus error - if ($err->{msg} =~ /Entity '\w+' not defined/) { + # 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; |