- From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 18 Apr 2007 06:27:23 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv7538/httpd/cgi-bin
Modified Files:
check
Log Message:
detection and listing of non-root namespaces had disappeared from 0.8 branch.
re-adding via sax/opensp api parsing
Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.499
retrieving revision 1.500
diff -u -d -r1.499 -r1.500
--- check 12 Apr 2007 07:18:15 -0000 1.499
+++ check 18 Apr 2007 06:27:20 -0000 1.500
@@ -981,7 +981,7 @@
$File->{Namespaces} = []; # reinitialize the list of non-root namespaces
# ... and then get a uniq version of it
foreach my $single_namespace (@bulk_ns) {
- push(@{$File->{Namespaces}}, $single_namespace) unless $seen_ns{$single_namespace}++;
+ push(@{$File->{Namespaces}}, $single_namespace) unless (($single_namespace eq $File->{Namespace}) or $seen_ns{$single_namespace}++);
}
my @nss = map({uri => $_}, @{$File->{Namespaces}});
$T->param(file_namespaces => \@nss) if @nss;
@@ -2243,10 +2243,11 @@
$self->{am_in_heading} = 1;
}
- 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;
+ my $has_xmlns = FALSE;
+ my $xmlns_value = undef;
+
+ if ( ($self->{_file}->{Mode} eq 'XML')){
+ # if in XML mode, find namespace used for each element
foreach my $attr (keys %{$element->{Attributes}}) {
if ($element->{Attributes}->{$attr}->{Name} eq "xmlns") {
# Try with SAX method
@@ -2267,42 +2268,50 @@
}
}
}
-
}
}
- if (($has_xmlns == FALSE) and ($CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{"Namespace Required"} eq TRUE )){
- # 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()?
- $err->{line} = $location->{LineNumber};
- $err->{char} = $location->{ColumnNumber};
- $err->{num} = "no-xmlns";
- $err->{type} = "E";
- $err->{msg} = "Missing xmlns attribute for element ".$element->{Name};
-
- # ...
- $self->{_file}->{'Is Valid'} = FALSE;
- push @{$self->{_file}->{Errors}}, $err;
- }
- 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} = $location->{LineNumber};
- $err->{char} = $location->{ColumnNumber};
- $err->{num} = "wrong-xmlns";
- $err->{type} = "E";
- $err->{msg} = "Wrong xmlns attribute for element ".$element->{Name}.". The value should be: ". $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace};
+ }
+
+ if (($element->{Name} eq $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Name})
+ and ($has_xmlns == FALSE)
+ and ($CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{"Namespace Required"} eq TRUE )){
+ # 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()?
+ $err->{line} = $location->{LineNumber};
+ $err->{char} = $location->{ColumnNumber};
+ $err->{num} = "no-xmlns";
+ $err->{type} = "E";
+ $err->{msg} = "Missing xmlns attribute for element ".$element->{Name};
- # ...
- $self->{_file}->{'Is Valid'} = FALSE;
- push @{$self->{_file}->{Errors}}, $err;
+ # ...
+ $self->{_file}->{'Is Valid'} = FALSE;
+ push @{$self->{_file}->{Errors}}, $err;
+ }
+ elsif (($element->{Name} eq $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Name})
+ and ($has_xmlns == TRUE) and (defined $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace})
+ and ($xmlns_value ne $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace}) ) {
+ # whine if root xmlns element is not the one specificed by the spec
+ my $err;
+ my $location = $self->{_parser}->get_location();
+ $err->{src} = '...'; # do this with show_open_entities()?
+ $err->{line} = $location->{LineNumber};
+ $err->{char} = $location->{ColumnNumber};
+ $err->{num} = "wrong-xmlns";
+ $err->{type} = "E";
+ $err->{msg} = "Wrong xmlns attribute for element ".$element->{Name}.". The value should be: ". $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace};
- }
+ # ...
+ $self->{_file}->{'Is Valid'} = FALSE;
+ push @{$self->{_file}->{Errors}}, $err;
+ }
+ elsif (($element->{Name} ne $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Name})
+ and ($has_xmlns == TRUE)) {
+ # add to list of non-root namespace
+ push(@{$self->{_file}->{Namespaces}}, $xmlns_value);
}
+
}
Received on Wednesday, 18 April 2007 06:27:32 UTC