Exemplo n.º 1
0
 public void test_XMLNode_namespace_get()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       node.addNamespace( "http://test1.org/", "test1");
       node.addNamespace( "http://test2.org/", "test2");
       node.addNamespace( "http://test3.org/", "test3");
       node.addNamespace( "http://test4.org/", "test4");
       node.addNamespace( "http://test5.org/", "test5");
       node.addNamespace( "http://test6.org/", "test6");
       node.addNamespace( "http://test7.org/", "test7");
       node.addNamespace( "http://test8.org/", "test8");
       node.addNamespace( "http://test9.org/", "test9");
       assertTrue( node.getNamespacesLength() == 9 );
       assertTrue( node.getNamespaceIndex( "http://test1.org/") == 0 );
       assertTrue( (  "test2" != node.getNamespacePrefix(1) ) == false );
       assertTrue( ( 		      "test1" != node.getNamespacePrefix( "http://test1.org/") ) == false );
       assertTrue( (  "http://test2.org/" != node.getNamespaceURI(1) ) == false );
       assertTrue( ( 		      "http://test2.org/" != node.getNamespaceURI( "test2") ) == false );
       assertTrue( node.getNamespaceIndex( "http://test1.org/") == 0 );
       assertTrue( node.getNamespaceIndex( "http://test2.org/") == 1 );
       assertTrue( node.getNamespaceIndex( "http://test5.org/") == 4 );
       assertTrue( node.getNamespaceIndex( "http://test9.org/") == 8 );
       assertTrue( node.getNamespaceIndex( "http://testX.org/") == -1 );
       assertTrue( node.hasNamespaceURI( "http://test1.org/") != false );
       assertTrue( node.hasNamespaceURI( "http://test2.org/") != false );
       assertTrue( node.hasNamespaceURI( "http://test5.org/") != false );
       assertTrue( node.hasNamespaceURI( "http://test9.org/") != false );
       assertTrue( node.hasNamespaceURI( "http://testX.org/") == false );
       assertTrue( node.getNamespaceIndexByPrefix( "test1") == 0 );
       assertTrue( node.getNamespaceIndexByPrefix( "test5") == 4 );
       assertTrue( node.getNamespaceIndexByPrefix( "test9") == 8 );
       assertTrue( node.getNamespaceIndexByPrefix( "testX") == -1 );
       assertTrue( node.hasNamespacePrefix( "test1") != false );
       assertTrue( node.hasNamespacePrefix( "test5") != false );
       assertTrue( node.hasNamespacePrefix( "test9") != false );
       assertTrue( node.hasNamespacePrefix( "testX") == false );
       assertTrue( node.hasNamespaceNS( "http://test1.org/", "test1") != false );
       assertTrue( node.hasNamespaceNS( "http://test5.org/", "test5") != false );
       assertTrue( node.hasNamespaceNS( "http://test9.org/", "test9") != false );
       assertTrue( node.hasNamespaceNS( "http://testX.org/", "testX") == false );
       node = null;
       triple = null;
       attr = null;
 }