removeNamespace() public method

public removeNamespace ( int index ) : int
index int
return int
 public void test_XMLToken_newSetters_removeNamespaces1()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       token.addNamespace( "http://test1.org/", "test1");
       assertTrue( token.getNamespacesLength() == 1 );
       int i = token.removeNamespace( "test2");
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       assertTrue( token.getNamespacesLength() == 1 );
       i = token.removeNamespace( "test1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getNamespacesLength() == 0 );
       token = null;
       triple = null;
       attr = null;
 }
Example #2
0
 public void test_XMLToken_namespace_remove_by_prefix()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       token.addNamespace( "http://test1.org/", "test1");
       token.addNamespace( "http://test2.org/", "test2");
       token.addNamespace( "http://test3.org/", "test3");
       token.addNamespace( "http://test4.org/", "test4");
       token.addNamespace( "http://test5.org/", "test5");
       assertTrue( token.getNamespacesLength() == 5 );
       token.removeNamespace( "test1");
       assertTrue( token.getNamespacesLength() == 4 );
       token.removeNamespace( "test2");
       assertTrue( token.getNamespacesLength() == 3 );
       token.removeNamespace( "test3");
       assertTrue( token.getNamespacesLength() == 2 );
       token.removeNamespace( "test4");
       assertTrue( token.getNamespacesLength() == 1 );
       token.removeNamespace( "test5");
       assertTrue( token.getNamespacesLength() == 0 );
       token.addNamespace( "http://test1.org/", "test1");
       token.addNamespace( "http://test2.org/", "test2");
       token.addNamespace( "http://test3.org/", "test3");
       token.addNamespace( "http://test4.org/", "test4");
       token.addNamespace( "http://test5.org/", "test5");
       assertTrue( token.getNamespacesLength() == 5 );
       token.removeNamespace( "test5");
       assertTrue( token.getNamespacesLength() == 4 );
       token.removeNamespace( "test4");
       assertTrue( token.getNamespacesLength() == 3 );
       token.removeNamespace( "test3");
       assertTrue( token.getNamespacesLength() == 2 );
       token.removeNamespace( "test2");
       assertTrue( token.getNamespacesLength() == 1 );
       token.removeNamespace( "test1");
       assertTrue( token.getNamespacesLength() == 0 );
       token.addNamespace( "http://test1.org/", "test1");
       token.addNamespace( "http://test2.org/", "test2");
       token.addNamespace( "http://test3.org/", "test3");
       token.addNamespace( "http://test4.org/", "test4");
       token.addNamespace( "http://test5.org/", "test5");
       assertTrue( token.getNamespacesLength() == 5 );
       token.removeNamespace( "test3");
       assertTrue( token.getNamespacesLength() == 4 );
       token.removeNamespace( "test1");
       assertTrue( token.getNamespacesLength() == 3 );
       token.removeNamespace( "test4");
       assertTrue( token.getNamespacesLength() == 2 );
       token.removeNamespace( "test5");
       assertTrue( token.getNamespacesLength() == 1 );
       token.removeNamespace( "test2");
       assertTrue( token.getNamespacesLength() == 0 );
       token = null;
       triple = null;
       attr = null;
 }