validator/httpd/cgi-bin check,1.756,1.757

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

Modified Files:
	check 
Log Message:
Clean up XML declaration regex.

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.756
retrieving revision 1.757
diff -u -d -r1.756 -r1.757
--- check	14 Dec 2009 22:19:09 -0000	1.756
+++ check	14 Dec 2009 22:39:18 -0000	1.757
@@ -647,7 +647,7 @@
             # handle a structured error (XML::LibXML::Error object)
             # (lib XML::LibXML > 0.66, but will work MUCH better > 0.69 )
 
-            my $err_obj = $@;
+            my $err_obj         = $@;
             my $num_xmlwf_error = 0;
             while ($err_obj) {
                 my $err;
@@ -2742,22 +2742,22 @@
                                 # the 10 first lines should be safe
     my $parseModeFromXMLDecl = (
         $begincontent =~
-            /^ [\x20|\x09|\x0D|\x0A]*                        # whitespace before the decl should not be happening
+            /^ [\x20\x09\x0D\x0A]*                    # whitespace before the decl should not be happening
                                                       # but we are greedy for the sake of detection, not validation
       <\?xml                                          # start matching an XML Declaration
-      [\x20|\x09|\x0D|\x0A]+                             # x20, x09, xD and xA are the allowed "xml white space"
-      version [\x20|\x09|\x0D|\x0A]* =                   # for documents, version info is mandatory
-      [\x20|\x09|\x0D|\x0A]* ("1.0"|"1.1"|'1.0'|'1.1')   # hardcoding the existing XML versions.
+      [\x20\x09\x0D\x0A]+                             # x20, x09, xD and xA are the allowed "xml white space"
+      version [\x20\x09\x0D\x0A]* =                   # for documents, version info is mandatory
+      [\x20\x09\x0D\x0A]* (["'])1.[01]\1              # hardcoding the existing XML versions.
                                                       # Maybe we should use \d\.\d
-      ([\x20|\x09|\x0D|\x0A]+ encoding
-       [\x20|\x09|\x0D|\x0A]* = [\x20|\x09|\x0D|\x0A]*
-       ("[A-Za-z][a-zA-Z0-9_-]+"|'[A-Za-z][a-zA-Z0-9_-]+')
+      (?:[\x20\x09\x0D\x0A]+ encoding
+       [\x20\x09\x0D\x0A]* = [\x20\x09\x0D\x0A]*
+       (["'])[A-Za-z][a-zA-Z0-9_-]+\2
       )?                                              # encoding info is optional
-      ([\x20|\x09|\x0D|\x0A]+ standalone
-       [\x20|\x09|\x0D|\x0A]* = [\x20|\x09|\x0D|\x0A]*
-       ("yes"|"no"|'yes'|'no')
+      (?:[\x20\x09\x0D\x0A]+ standalone
+       [\x20\x09\x0D\x0A]* = [\x20\x09\x0D\x0A]*
+       (["'])(?:yes|no)\3
       )?                                              # ditto standalone info, optional
-      [\x20|\x09|\x0D|\x0A]* \?>                         # end of XML Declaration
+      [\x20\x09\x0D\x0A]* \?>                         # end of XML Declaration
     /x
         ?
             'XML' :

Received on Monday, 14 December 2009 22:39:29 UTC