Commits

Anonymous committed c543c37

Modified Files:
t/14sax.t
+ tests provided by barrie slaymaker

  • Participants
  • Parent commits 9fbc545

Comments (0)

Files changed (1)

 use Test;
-BEGIN { plan tests => 46 }
+
+BEGIN { plan tests => 48 }
+
 use XML::LibXML;
+use XML::LibXML::SAX;
 use XML::LibXML::SAX::Parser;
 use XML::LibXML::SAX::Builder;
 use XML::SAX;
 
 $parser->parse_uri("example/ns.xml");
 
+########### Namespace test ( empty namespaces ) ########
+
+{
+    my $h = "SAXNS2Tester";
+    my $xml = "<a xmlns='A'><b/></a>";
+    my @tests = (
+sub {
+    XML::LibXML::SAX        ->new( Handler => $h )->parse_string( $xml );
+},
+
+sub {
+    XML::LibXML::SAX::Parser->new( Handler => $h )->parse_string( $xml );
+},
+);  
+    
+    $_->() for @tests;
+
+}
+
+
 ########### Helper class #############
 
 package SAXTester;
 use Test;
 
-# local $XML::LibXML::ORIGINAL_STRING = 1;
-
 sub new {
     my $class = shift;
     return bless {}, $class;
   # warn("characters: $chars->{Data}\n");
 }
 
+1;
+
 package SAXNSTester;
 use Test;
 
     ok($node->{NamespaceURI} =~ /^(urn:camels|urn:mammals|urn:a)$/);
 }
 
+1;
+
+package SAXNS2Tester;
+use Test;
+
+#sub new {
+#    my $class = shift;
+#    return bless {}, $class;
+#}
+
+sub start_element {
+    my $self = shift;
+    my ( $elt ) = @_;
+    ok $elt->{NamespaceURI} eq "A"
+        if $elt->{Name} eq "b"
+}
+
+1;