- From: Ville Skytta via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 30 Jun 2009 18:49:09 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv6786
Modified Files:
check
Log Message:
Speed up xmlns parsing.
Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.672
retrieving revision 1.673
diff -u -d -r1.672 -r1.673
--- check 30 Jun 2009 17:26:45 -0000 1.672
+++ check 30 Jun 2009 18:49:07 -0000 1.673
@@ -3026,28 +3026,22 @@
my $has_xmlns = FALSE;
my $xmlns_value = undef;
- if ( ($self->{_file}->{Mode} =~ /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
- if($element->{Attributes}->{$attr}->{Value} ){
- $has_xmlns = TRUE;
- $xmlns_value = $element->{Attributes}->{$attr}->{Value};
- }
- #next if ($has_xmlns);
-
- # the following is not SAX, but OPENSP specific
-
- if ( $element->{Attributes}->{$attr}->{Defaulted}){
+ # If in XML mode, find namespace used for each element.
+ if ($self->{_file}->{Mode} =~ /XML/) {
+ if (my $attr = $element->{Attributes}->{xmlns}) {
+ $xmlns_value = "";
+ # Try with SAX method
+ if ($attr->{Value}) {
+ $has_xmlns = TRUE;
+ $xmlns_value = $attr->{Value};
+ }
+ #next if $has_xmlns;
- if ($element->{Attributes}->{$attr}->{Defaulted} eq "specified") {
- $has_xmlns = TRUE;
- foreach my $datachunk (@{$element->{Attributes}->{$attr}->{CdataChunks}}) {
- $xmlns_value = $xmlns_value.$datachunk->{Data};
- }
- }
- }
+ # The following is not SAX, but OpenSP specific.
+ my $defaulted = $attr->{Defaulted} || '';
+ if ($defaulted eq "specified") {
+ $has_xmlns = TRUE;
+ $xmlns_value .= join("", map { $_->{Data} } @{$attr->{CdataChunks}});
}
}
}
Received on Tuesday, 30 June 2009 18:49:17 UTC