link-checker commit: Set XML parsing mode also based on Content-Type in addition to public ID,

changeset:   221:2b4e5aa92acc
user:        ville
date:        Sun Feb 10 18:13:59 2008 +0000
files:       bin/checklink
description:
Set XML parsing mode also based on Content-Type in addition to public ID,
relax public ID matching for XML mode so that it catches XHTML Mobile,
XHTML-Print and XHTML+RDFa.


diff -r 6fedbb560c75 -r 2b4e5aa92acc bin/checklink
--- a/bin/checklink	Sun Feb 10 18:10:31 2008 +0000
+++ b/bin/checklink	Sun Feb 10 18:13:59 2008 +0000
@@ -5,7 +5,7 @@
 # (c) 1999-2008 World Wide Web Consortium
 # based on Renaud Bruyeron's checklink.pl
 #
-# $Id: checklink,v 4.91 2008-02-10 18:10:31 ville Exp $
+# $Id: checklink,v 4.92 2008-02-10 18:13:59 ville Exp $
 #
 # This program is licensed under the W3C(r) Software License:
 #       http://www.w3.org/Consortium/Legal/copyright-software
@@ -244,7 +244,7 @@
   $PROGRAM     = 'W3C-checklink';
   $VERSION     = '4.3';
   $REVISION    = sprintf('version %s (c) 1999-2008 W3C', $VERSION);
-  my ($cvsver) = q$Revision: 4.91 $ =~ /(\d+[\d\.]*\.\d+)/;
+  my ($cvsver) = q$Revision: 4.92 $ =~ /(\d+[\d\.]*\.\d+)/;
   $AGENT       = sprintf('%s/%s [%s] %s',
                          $PROGRAM, $VERSION, $cvsver, LWP::RobotUA->_agent());
 
@@ -1353,6 +1353,8 @@
   # for right now.
   $$docref =~ s/\<\?(xml:stylesheet.*?)\?\>/\<$1\>/ unless $p->{only_anchors};
 
+  $p->xml_mode(1) if ($response->content_type() =~ /\+xml$/);
+
   $p->parse($$docref)->eof();
   $response->content("");
 
@@ -1425,8 +1427,9 @@
       m%^-//W3C//DTD HTML 3\.2//%) {
     $self->{check_id} = 0;
   }
-  # Enable XML extensions
-  $self->xml_mode(1) if (m%^-//W3C//DTD XHTML %);
+
+  # Enable XML mode (XHTML, XHTML Mobile, XHTML-Print, XHTML+RDFa, ...)
+  $self->xml_mode(1) if (m%^-//(W3C|WAPFORUM)//DTD XHTML[ \-\+]%);
 
   return;
 }

Received on Thursday, 5 August 2010 14:47:32 UTC