validator/httpd/cgi-bin check,1.507,1.508

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

Modified Files:
	check 
Log Message:
More warning cleanups.

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.507
retrieving revision 1.508
diff -u -d -r1.507 -r1.508
--- check	27 Apr 2007 20:36:31 -0000	1.507
+++ check	28 Apr 2007 07:06:35 -0000	1.508
@@ -802,7 +802,8 @@
 #
 # check the received mime type against Allowed mime types
 if ($File->{ContentType}){
-  my @allowedMediaType = split(" ", $CFG->{Types}->{$File->{DOCTYPE}}->{Types}->{Allowed});
+  my @allowedMediaType =
+    split(/\s+/, $CFG->{Types}->{$File->{DOCTYPE}}->{Types}->{Allowed} || '');
   my $usedCTisAllowed;
   if (scalar @allowedMediaType)  {
     $usedCTisAllowed = FALSE;
@@ -1886,7 +1887,7 @@
   my $File = shift;
   my $CFG = shift;
   my $fpi = $File->{DOCTYPE};
-  my $parseModeFromDoctype = $CFG->{Types}->{$fpi}->{'Parse Mode'};
+  my $parseModeFromDoctype = $CFG->{Types}->{$fpi}->{'Parse Mode'} || 'TBD';
 
   my $parseModeFromMimeType = $File->{Mode};
 
@@ -2269,9 +2270,14 @@
 
   my $doctype = $self->{_file}->{DOCTYPE};
 
-  if (($element->{Name} eq $CFG->{Types}->{$doctype}->{Name})
-  and !$has_xmlns and ($CFG->{Types}->{$doctype}->{"Namespace Required"})) {
-    # whine if the root xmlns attribute is noted as required by spec, but not present
+  if (!defined($CFG->{Types}->{$doctype}->{Name}) ||
+      $element->{Name} ne $CFG->{Types}->{$doctype}->{Name}) {
+    # add to list of non-root namespaces
+    push(@{$self->{_file}->{Namespaces}}, $xmlns_value) if $has_xmlns;
+  }
+  elsif (!$has_xmlns and $CFG->{Types}->{$doctype}->{"Namespace Required"}) {
+    # whine if the root xmlns attribute is noted as required by spec,
+    # but not present
     my $err;
     my $location = $self->{_parser}->get_location();
     $err->{src}  = '...'; # do this with show_open_entities()?
@@ -2285,8 +2291,7 @@
     $self->{_file}->{'Is Valid'} = FALSE;
     push @{$self->{_file}->{Errors}}, $err;
   }
-  elsif (($element->{Name} eq $CFG->{Types}->{$doctype}->{Name})
-  and $has_xmlns and (defined $CFG->{Types}->{$doctype}->{Namespace})
+  elsif ($has_xmlns and (defined $CFG->{Types}->{$doctype}->{Namespace})
   and ($xmlns_value ne $CFG->{Types}->{$doctype}->{Namespace}) ) {
     # whine if root xmlns element is not the one specificed by the spec
     my $err;
@@ -2303,12 +2308,6 @@
     $self->{_file}->{'Is Valid'} = FALSE;
     push @{$self->{_file}->{Errors}}, $err;
   }
-  elsif (($element->{Name} ne $CFG->{Types}->{$doctype}->{Name})
-  and $has_xmlns) {
-    # add to list of non-root namespace
-    push(@{$self->{_file}->{Namespaces}}, $xmlns_value);
-  }
-
 }
 
 

Received on Saturday, 28 April 2007 07:06:39 UTC