当前位置: 首页>>代码示例>>C#>>正文


C# XMLAttributes.getName方法代码示例

本文整理汇总了C#中libsbml.XMLAttributes.getName方法的典型用法代码示例。如果您正苦于以下问题:C# XMLAttributes.getName方法的具体用法?C# XMLAttributes.getName怎么用?C# XMLAttributes.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在libsbml.XMLAttributes的用法示例。


在下文中一共展示了XMLAttributes.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: test_XMLAttributes_add_get

 public void test_XMLAttributes_add_get()
 {
     XMLAttributes attrs = new XMLAttributes();
       assertTrue( attrs.getLength() == 0 );
       assertEquals( true, attrs.isEmpty() );
       attrs.add("xmlns", "http://foo.org/");
       assertTrue( attrs.getLength() == 1 );
       assertTrue( attrs.isEmpty() == false );
       attrs.add("foo", "bar");
       assertTrue( attrs.getLength() == 2 );
       assertTrue( attrs.isEmpty() == false );
       assertTrue( attrs.getIndex("xmlns") == 0 );
       assertTrue( attrs.getIndex("foo"  ) == 1 );
       assertTrue( attrs.getIndex("bar"  ) == -1 );
       assertTrue( attrs.getValue("xmlns") ==  "http://foo.org/"  );
       assertTrue( attrs.getValue("foo"  ) ==  "bar"              );
       assertTrue( attrs.getValue("bar"  ) ==  ""                 );
       assertTrue( attrs.getName(0) ==  "xmlns"  );
       assertTrue( attrs.getName(1) ==  "foo"    );
       assertTrue( attrs.getName(2) ==  ""       );
 }
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:21,代码来源:TestXMLAttributes.cs

示例2: test_XMLAttributes_assignment

 public void test_XMLAttributes_assignment()
 {
     XMLAttributes att1 = new XMLAttributes();
       att1.add("xmlns", "http://foo.org/");
       assertTrue( att1.getLength() == 1 );
       assertTrue( att1.isEmpty() == false );
       assertTrue( att1.getIndex("xmlns") == 0 );
       assertTrue( att1.getName(0) ==   "xmlns"  );
       assertTrue( att1.getValue("xmlns") ==  "http://foo.org/"  );
       XMLAttributes att2 = new XMLAttributes();
       att2 = att1;
       assertTrue( att2.getLength() == 1 );
       assertTrue( att2.isEmpty() == false );
       assertTrue( att2.getIndex("xmlns") == 0 );
       assertTrue( att2.getName(0) ==   "xmlns"  );
       assertTrue( att2.getValue("xmlns") ==  "http://foo.org/"  );
       att2 = null;
       att1 = null;
 }
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:19,代码来源:TestXMLAttributes.cs

示例3: test_XMLAttributes_add_remove_qname_C

 public void test_XMLAttributes_add_remove_qname_C()
 {
     XMLAttributes xa = new  XMLAttributes();
       XMLTriple xt1 = new  XMLTriple("name1", "http://name1.org/", "p1");
       XMLTriple xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
       XMLTriple xt3 = new  XMLTriple("name3", "http://name3.org/", "p3");
       XMLTriple xt1a = new  XMLTriple("name1", "http://name1a.org/", "p1a");
       XMLTriple xt2a = new  XMLTriple("name2", "http://name2a.org/", "p2a");
       xa.add( "name1", "val1", "http://name1.org/", "p1");
       xa.add(xt2, "val2");
       assertTrue( xa.getLength() == 2 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "name1" != xa.getName(0) ) == false );
       assertTrue( (  "val1"  != xa.getValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != xa.getURI(0) ) == false );
       assertTrue( (  "p1"    != xa.getPrefix(0) ) == false );
       assertTrue( (  "name2" != xa.getName(1) ) == false );
       assertTrue( (  "val2"  != xa.getValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != xa.getURI(1) ) == false );
       assertTrue( (  "p2"    != xa.getPrefix(1) ) == false );
       assertTrue( (  "val1"  != xa.getValue( "name1") ) == false );
       assertTrue( (  "val2"  != xa.getValue( "name2") ) == false );
       assertTrue( (  "val1"  != xa.getValue( "name1", "http://name1.org/") ) == false );
       assertTrue( (  "val2"  != xa.getValue( "name2", "http://name2.org/") ) == false );
       assertTrue( (  "val1"  != xa.getValue(xt1) ) == false );
       assertTrue( (  "val2"  != xa.getValue(xt2) ) == false );
       assertTrue( xa.hasAttribute(-1) == false );
       assertTrue( xa.hasAttribute(2) == false );
       assertTrue( xa.hasAttribute(0) == true );
       assertTrue( xa.hasAttribute( "name1", "http://name1.org/") == true );
       assertTrue( xa.hasAttribute( "name2", "http://name2.org/") == true );
       assertTrue( xa.hasAttribute( "name3", "http://name3.org/") == false );
       assertTrue( xa.hasAttribute(xt1) == true );
       assertTrue( xa.hasAttribute(xt2) == true );
       assertTrue( xa.hasAttribute(xt3) == false );
       xa.add( "noprefix", "val3");
       assertTrue( xa.getLength() == 3 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "noprefix" != xa.getName(2) ) == false );
       assertTrue( (  "val3"     != xa.getValue(2) ) == false );
       assertTrue( xa.getURI(2) == "" );
       assertTrue( xa.getPrefix(2) == "" );
       assertTrue( (  "val3"  != xa.getValue( "noprefix", "") ) == false );
       assertTrue( xa.hasAttribute( "noprefix"    ) == true );
       assertTrue( xa.hasAttribute( "noprefix", "") == true );
       xa.add(xt1, "mval1");
       xa.add( "name2", "mval2", "http://name2.org/", "p2");
       xa.add( "noprefix", "mval3");
       assertTrue( xa.getLength() == 3 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "name1" != xa.getName(0) ) == false );
       assertTrue( (  "mval1" != xa.getValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != xa.getURI(0) ) == false );
       assertTrue( (  "p1"    != xa.getPrefix(0) ) == false );
       assertTrue( (  "name2"    != xa.getName(1) ) == false );
       assertTrue( (  "mval2"    != xa.getValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != xa.getURI(1) ) == false );
       assertTrue( (  "p2"       != xa.getPrefix(1) ) == false );
       assertTrue( (  "noprefix" != xa.getName(2) ) == false );
       assertTrue( (  "mval3"    != xa.getValue(2) ) == false );
       assertTrue( xa.getURI(2) == "" );
       assertTrue( xa.getPrefix(2) == "" );
       assertTrue( xa.hasAttribute(xt1) == true );
       assertTrue( xa.hasAttribute( "name1", "http://name1.org/") == true );
       assertTrue( xa.hasAttribute( "noprefix") == true );
       xa.add(xt1a, "val1a");
       xa.add(xt2a, "val2a");
       assertTrue( xa.getLength() == 5 );
       assertTrue( (  "name1" != xa.getName(3) ) == false );
       assertTrue( (  "val1a" != xa.getValue(3) ) == false );
       assertTrue( (  "http://name1a.org/" != xa.getURI(3) ) == false );
       assertTrue( (  "p1a" != xa.getPrefix(3) ) == false );
       assertTrue( (  "name2" != xa.getName(4) ) == false );
       assertTrue( (  "val2a" != xa.getValue(4) ) == false );
       assertTrue( (  "http://name2a.org/" != xa.getURI(4) ) == false );
       assertTrue( (  "p2a" != xa.getPrefix(4) ) == false );
       assertTrue( (  "mval1"  != xa.getValue( "name1") ) == false );
       assertTrue( (  "mval2"  != xa.getValue( "name2") ) == false );
       assertTrue( (  "val1a"  != xa.getValue( "name1", "http://name1a.org/") ) == false );
       assertTrue( (  "val2a"  != xa.getValue( "name2", "http://name2a.org/") ) == false );
       assertTrue( (  "val1a"  != xa.getValue(xt1a) ) == false );
       assertTrue( (  "val2a"  != xa.getValue(xt2a) ) == false );
       xa.remove(xt1a);
       xa.remove(xt2a);
       assertTrue( xa.getLength() == 3 );
       xa.remove( "name1", "http://name1.org/");
       assertTrue( xa.getLength() == 2 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "name2" != xa.getName(0) ) == false );
       assertTrue( (  "mval2" != xa.getValue(0) ) == false );
       assertTrue( (  "http://name2.org/" != xa.getURI(0) ) == false );
       assertTrue( (  "p2" != xa.getPrefix(0) ) == false );
       assertTrue( (  "noprefix" != xa.getName(1) ) == false );
       assertTrue( (  "mval3" != xa.getValue(1) ) == false );
       assertTrue( xa.getURI(1) == "" );
       assertTrue( xa.getPrefix(1) == "" );
       assertTrue( xa.hasAttribute( "name1", "http://name1.org/") == false );
       xa.remove(xt2);
       assertTrue( xa.getLength() == 1 );
       assertTrue( xa.isEmpty() == false );
//.........这里部分代码省略.........
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:101,代码来源:TestXMLAttributesC.cs


注:本文中的libsbml.XMLAttributes.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。