Anonymous avatar Anonymous committed fb2b3e0

Added Files:
+ namespace tests

Comments (0)

Files changed (1)

+use Test;
+BEGIN { plan tests=>21; }
+END {ok(0) unless $loaded;}
+use XML::LibXML;
+$loaded = 1;
+my $xml = <<EOX;
+<a xmlns:b="http://whatever"
+><x b:href="out.xml"
+my $doc = XML::LibXML->new()->parse_string($xml);
+my $docElem = $doc->getDocumentElement();
+my $child = ($docElem->getChildnodes())[0];
+my $val = $child->getAttributeNS('http://whatever','href');
+$child = ($docElem->getChildnodes())[1];
+ok($child->getLocalName() eq 'c');
+ok($child->getPrefix() eq 'b');
+ok($child->getNamespaceURI() eq 'http://whatever');
+my $added_attr = 'added.xml';
+$child->setAttributeNS('http://whatever', 'b2:href', $added_attr);
+   && $child->getAttributeNS('http://whatever','href') eq $added_attr);
+my @bytag = $docElem->getElementsByTagName('x');
+ok(scalar(@bytag) == 1);
+@bytag = $docElem->getElementsByTagNameNS('http://whatever','c');
+ok(scalar(@bytag) == 1);
+my $tag = pop @bytag;
+ok($tag->getLocalName() eq 'c');
+ok($tag->getPrefix() eq 'b');
+ok($tag->getNamespaceURI() eq 'http://whatever');
+my $newElem = $doc->createElementNS('http://whatever','d:newElem');
+ok($newElem->getLocalName, 'newElem');
+ok($newElem->getPrefix, 'd');
+ok($newElem->getNamespaceURI, 'http://whatever');
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.