addNamespace() публичный Метод

public addNamespace ( string uri ) : int
uri string
Результат int
Пример #1
0
 public void test_XMLToken_newSetters_addNamespaces1()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       assertTrue( token.getNamespacesLength() == 0 );
       assertTrue( token.isNamespacesEmpty() == true );
       int i = token.addNamespace( "http://test1.org/", "test1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getNamespacesLength() == 1 );
       assertTrue( token.isNamespacesEmpty() == false );
       attr = null;
       triple = null;
       token = null;
 }
Пример #2
0
 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;
 }
Пример #3
0
 public void test_XMLToken_newSetters_addNamespaces2()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLToken token = new  XMLToken(triple);
       assertTrue( token.getNamespacesLength() == 0 );
       assertTrue( token.isNamespacesEmpty() == true );
       int i = token.addNamespace( "http://test1.org/", "test1");
       assertTrue( i == libsbml.LIBSBML_INVALID_XML_OPERATION );
       assertTrue( token.getNamespacesLength() == 0 );
       assertTrue( token.isNamespacesEmpty() == true );
       triple = null;
       token = null;
 }
Пример #4
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;
 }
Пример #5
0
 public void test_XMLToken_namespace_get()
 {
     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");
       token.addNamespace( "http://test6.org/", "test6");
       token.addNamespace( "http://test7.org/", "test7");
       token.addNamespace( "http://test8.org/", "test8");
       token.addNamespace( "http://test9.org/", "test9");
       assertTrue( token.getNamespacesLength() == 9 );
       assertTrue( token.getNamespaceIndex( "http://test1.org/") == 0 );
       assertTrue( (  "test2" != token.getNamespacePrefix(1) ) == false );
       assertTrue( ( 		      "test1" != token.getNamespacePrefix( "http://test1.org/") ) == false );
       assertTrue( (  "http://test2.org/" != token.getNamespaceURI(1) ) == false );
       assertTrue( ( 		      "http://test2.org/" != token.getNamespaceURI( "test2") ) == false );
       assertTrue( token.getNamespaceIndex( "http://test1.org/") == 0 );
       assertTrue( token.getNamespaceIndex( "http://test2.org/") == 1 );
       assertTrue( token.getNamespaceIndex( "http://test5.org/") == 4 );
       assertTrue( token.getNamespaceIndex( "http://test9.org/") == 8 );
       assertTrue( token.getNamespaceIndex( "http://testX.org/") == -1 );
       assertTrue( token.hasNamespaceURI( "http://test1.org/") != false );
       assertTrue( token.hasNamespaceURI( "http://test2.org/") != false );
       assertTrue( token.hasNamespaceURI( "http://test5.org/") != false );
       assertTrue( token.hasNamespaceURI( "http://test9.org/") != false );
       assertTrue( token.hasNamespaceURI( "http://testX.org/") == false );
       assertTrue( token.getNamespaceIndexByPrefix( "test1") == 0 );
       assertTrue( token.getNamespaceIndexByPrefix( "test5") == 4 );
       assertTrue( token.getNamespaceIndexByPrefix( "test9") == 8 );
       assertTrue( token.getNamespaceIndexByPrefix( "testX") == -1 );
       assertTrue( token.hasNamespacePrefix( "test1") != false );
       assertTrue( token.hasNamespacePrefix( "test5") != false );
       assertTrue( token.hasNamespacePrefix( "test9") != false );
       assertTrue( token.hasNamespacePrefix( "testX") == false );
       assertTrue( token.hasNamespaceNS( "http://test1.org/", "test1") != false );
       assertTrue( token.hasNamespaceNS( "http://test5.org/", "test5") != false );
       assertTrue( token.hasNamespaceNS( "http://test9.org/", "test9") != false );
       assertTrue( token.hasNamespaceNS( "http://testX.org/", "testX") == false );
       token = null;
       triple = null;
       attr = null;
 }
Пример #6
0
 public void test_XMLToken_namespace_add()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       assertTrue( token.getNamespacesLength() == 0 );
       assertTrue( token.isNamespacesEmpty() == true );
       token.addNamespace( "http://test1.org/", "test1");
       assertTrue( token.getNamespacesLength() == 1 );
       assertTrue( token.isNamespacesEmpty() == false );
       token.addNamespace( "http://test2.org/", "test2");
       assertTrue( token.getNamespacesLength() == 2 );
       assertTrue( token.isNamespacesEmpty() == false );
       token.addNamespace( "http://test1.org/", "test1a");
       assertTrue( token.getNamespacesLength() == 3 );
       assertTrue( token.isNamespacesEmpty() == false );
       token.addNamespace( "http://test1.org/", "test1a");
       assertTrue( token.getNamespacesLength() == 3 );
       assertTrue( token.isNamespacesEmpty() == false );
       assertTrue( ! (token.getNamespaceIndex( "http://test1.org/") == -1) );
       token = null;
       triple = null;
       attr = null;
 }