]> git.sesse.net Git - xml-template/commitdiff
Parse the IDs properly. perl-sax/simple passes!
authorsgunderson@bigfoot.com <>
Thu, 1 Mar 2007 02:13:58 +0000 (03:13 +0100)
committersgunderson@bigfoot.com <>
Thu, 1 Mar 2007 02:13:58 +0000 (03:13 +0100)
perl-sax/XML/TemplateSAX.pm

index 18c8d6849b34f904de2cb59f5f51f6d92f70c325..ff68c1f9c464b552c3a907d4b54c94b32b2f0fc5 100644 (file)
@@ -39,6 +39,10 @@ sub start_element {
        my ($self, $data) = @_;
        my $obj = $self->{'obj'};
 
+       # find the ID, if any
+       my $id = $data->{'Attributes'}->{'{http://template.sesse.net/}id'};
+       $id = $id->{'Value'} if (defined($id));
+
        # within a replacement; just ignore everything  
        return if (!defined($obj));
 
@@ -48,7 +52,7 @@ sub start_element {
                my $match = undef;
                for my $key (keys %$obj) {
                        if ($key =~ /^#(.*)$/) {
-                               if ($data->{'NamespaceURI'} eq 'http://template.sesse.net/' && $data->{'LocalName'} eq $1) {
+                               if (defined($id) && $id eq $1) {
                                        $match = $obj->{$key};
                                        last;
                                }