W3C home > Mailing lists > Public > www-validator-cvs@w3.org > April 2007

validator/httpd/cgi-bin check,1.492,1.493

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 02 Apr 2007 06:46:34 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1HYGJG-0002Js-H1@lionel-hutz.w3.org>

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

Modified Files:
	check 
Log Message:
* checking presence and value of xmlns for any root element of XML docs, not just html (e.g smil, etc)
* bug fix for location of error when xmlns value is incorrect



Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.492
retrieving revision 1.493
diff -u -d -r1.492 -r1.493
--- check	29 Mar 2007 12:42:33 -0000	1.492
+++ check	2 Apr 2007 06:46:32 -0000	1.493
@@ -2195,7 +2195,7 @@
     $self->{am_in_heading} = 1;
   }
   
-  if (($element->{Name} eq 'html') and ($self->{_file}->{Mode} eq 'XML')){
+  if (($element->{Name} eq $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Name}) and ($self->{_file}->{Mode} eq 'XML')){
     # we check if xmlns has been properly given
     my $has_xmlns = FALSE;
     my $xmlns_value = undef;
@@ -2236,15 +2236,17 @@
       $self->{_file}->{'Is Valid'} = FALSE;
       push @{$self->{_file}->{Errors}}, $err;
     }
-    elsif (($has_xmlns == TRUE) and ($xmlns_value ne $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace}) ) {
+    elsif (($has_xmlns == TRUE) 
+     and (defined $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace}) 
+     and ($xmlns_value ne $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace}) ) {
       my $err;
-
+      my $location = $self->{_parser}->get_location();
       $err->{src}  = '...'; # do this with show_open_entities()?
-      $err->{line} = $element->{Location};
-      $err->{char} = $element->{Location};
+      $err->{line} = $location->{LineNumber};
+      $err->{char} = $location->{ColumnNumber};
       $err->{num}  = "wrong-xmlns";
       $err->{type} = "E";
-      $err->{msg}  = "Wrong xmlns attribute for element ".$element->{Name}.". Value should be". $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace};
+      $err->{msg}  = "Wrong xmlns attribute for element ".$element->{Name}.". The value should be: ". $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace};
 
       # ...
       $self->{_file}->{'Is Valid'} = FALSE;
Received on Monday, 2 April 2007 06:46:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:54:56 GMT