summaryrefslogtreecommitdiffstats
path: root/httpd/cgi-bin/check
diff options
context:
space:
mode:
Diffstat (limited to 'httpd/cgi-bin/check')
-rwxr-xr-xhttpd/cgi-bin/check27
1 files changed, 21 insertions, 6 deletions
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;