public void test_XMLNode_clearNamespaces()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLNamespaces nms;
       int i = node.addNamespace( "http://test1.org/", "test1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 1 );
       i = node.addNamespace( "http://test2.org/", "test2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.clearNamespaces();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 0 );
       triple = null;
       attr = null;
       node = null;
 }
Ejemplo n.º 2
0
 public void test_XMLNode_namespace_set_clear()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLNamespaces ns = new  XMLNamespaces();
       assertTrue( node.getNamespacesLength() == 0 );
       assertTrue( node.isNamespacesEmpty() == true );
       ns.add( "http://test1.org/", "test1");
       ns.add( "http://test2.org/", "test2");
       ns.add( "http://test3.org/", "test3");
       ns.add( "http://test4.org/", "test4");
       ns.add( "http://test5.org/", "test5");
       node.setNamespaces(ns);
       assertTrue( node.getNamespacesLength() == 5 );
       assertTrue( node.isNamespacesEmpty() == false );
       assertTrue( (  "test1" != node.getNamespacePrefix(0) ) == false );
       assertTrue( (  "test2" != node.getNamespacePrefix(1) ) == false );
       assertTrue( (  "test3" != node.getNamespacePrefix(2) ) == false );
       assertTrue( (  "test4" != node.getNamespacePrefix(3) ) == false );
       assertTrue( (  "test5" != node.getNamespacePrefix(4) ) == false );
       assertTrue( (  "http://test1.org/" != node.getNamespaceURI(0) ) == false );
       assertTrue( (  "http://test2.org/" != node.getNamespaceURI(1) ) == false );
       assertTrue( (  "http://test3.org/" != node.getNamespaceURI(2) ) == false );
       assertTrue( (  "http://test4.org/" != node.getNamespaceURI(3) ) == false );
       assertTrue( (  "http://test5.org/" != node.getNamespaceURI(4) ) == false );
       node.clearNamespaces();
       assertTrue( node.getNamespacesLength() == 0 );
       assertTrue( node.isAttributesEmpty() != false );
       ns = null;
       node = null;
       triple = null;
       attr = null;
 }