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


C# XMLAttributes.add方法代码示例

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


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

示例1: test_XMLAttributes_add1

 public void test_XMLAttributes_add1()
 {
     XMLAttributes xa = new  XMLAttributes();
       XMLTriple xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
       int i = xa.add( "name1", "val1", "http://name1.org/", "p1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = xa.add(xt2, "val2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 2 );
       assertTrue( xa.isEmpty() == false );
       i = xa.add( "noprefix", "val3");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 3 );
       assertTrue( xa.isEmpty() == false );
       xa = null;
       xt2 = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:17,代码来源:TestXMLAttributesC.cs

示例2: 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:,项目名称:,代码行数:21,代码来源:

示例3: 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:,项目名称:,代码行数:19,代码来源:

示例4: test_CVTerm_createFromNode

 public void test_CVTerm_createFromNode()
 {
     XMLAttributes xa;
       XMLTriple qual_triple = new  XMLTriple("is", "", "bqbiol");
       XMLTriple bag_triple = new  XMLTriple();
       XMLTriple li_triple = new  XMLTriple();
       XMLAttributes att = new  XMLAttributes();
       att.add( "", "This is my resource");
       XMLAttributes att1 = new  XMLAttributes();
       XMLToken li_token = new  XMLToken(li_triple,att);
       XMLToken bag_token = new  XMLToken(bag_triple,att1);
       XMLToken qual_token = new  XMLToken(qual_triple,att1);
       XMLNode li = new XMLNode(li_token);
       XMLNode bag = new XMLNode(bag_token);
       XMLNode node = new XMLNode(qual_token);
       bag.addChild(li);
       node.addChild(bag);
       CVTerm term = new  CVTerm(node);
       assertTrue( term != null );
       assertTrue( term.getQualifierType() == libsbml.BIOLOGICAL_QUALIFIER );
       assertTrue( term.getBiologicalQualifierType() == libsbml.BQB_IS );
       xa = term.getResources();
       assertTrue( xa.getLength() == 1 );
       assertTrue((  "rdf:resource" == xa.getName(0) ));
       assertTrue((  "This is my resource" == xa.getValue(0) ));
       qual_triple = null;
       bag_triple = null;
       li_triple = null;
       li_token = null;
       bag_token = null;
       qual_token = null;
       att = null;
       att1 = null;
       term = null;
       node = null;
       bag = null;
       li = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:38,代码来源:TestCVTerms.cs

示例5: Main

    public static int Main(string[] args)
    {
        if (args.Length != 2)
        {
            Console.WriteLine("  usage: addingEvidenceCodes_2 <input-filename> <output-filename>");
            Console.WriteLine("  Adds controlled vocabulary term to a species");
            Console.WriteLine();
            return 2;
        }

        SBMLDocument d = libsbml.readSBML(args[0]);
        long errors = d.getNumErrors();

        if (errors > 0)
        {
            Console.WriteLine("Read Error(s):");
            d.printErrors();

            Console.WriteLine("Correct the above and re-run.");
        }
        else
        {
            long n = d.getModel().getNumSpecies();

            if (n <= 0)
            {
                Console.WriteLine("Model has no species.\n Cannot add CV terms\n");
            }
            else
            {
                Species s = d.getModel().getSpecies(0);

                /* check that the species has a metaid
           * no CVTerms will be added if there is no metaid to reference
           */
                if (!s.isSetMetaId())
                    s.setMetaId("metaid_0000052");

                CVTerm cv1 = new CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
                cv1.setBiologicalQualifierType(libsbml.BQB_OCCURS_IN);
                cv1.addResource("urn:miriam:obo.go:GO%3A0005764");

                s.addCVTerm(cv1);

                // now create the additional annotation

                //<rdf:Statement>
                //  <rdf:subject rdf:resource="#metaid_0000052"/>
                //  <rdf:predicate rdf:resource="http://biomodels.net/biology-qualifiers/occursIn"/>
                //  <rdf:object rdf:resource="urn:miriam:obo.go:GO%3A0005764"/>
                //  <bqbiol:isDescribedBy>
                //    <rdf:Bag>
                //      <rdf:li rdf:resource="urn:miriam:obo.eco:ECO%3A0000004"/>
                //      <rdf:li rdf:resource="urn:miriam:pubmed:7017716"/>
                //    </rdf:Bag>
                //  </bqbiol:isDescribedBy>
                //</rdf:Statement>

                /* attributes */
                XMLAttributes blank_att = new XMLAttributes();

                XMLAttributes resource_att = new XMLAttributes();

                /* create the outer statement node */
                XMLTriple statement_triple = new XMLTriple("Statement",
                                                       "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                       "rdf");

                XMLToken statement_token = new XMLToken(statement_triple, blank_att);

                XMLNode statement = new XMLNode(statement_token);

                /*create the subject node */
                XMLTriple subject_triple = new XMLTriple("subject",
                                                     "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                     "rdf");

                resource_att.clear();
                resource_att.add("rdf:resource", "#" + s.getMetaId());

                XMLToken subject_token = new XMLToken(subject_triple, resource_att);

                XMLNode subject = new XMLNode(subject_token);

                /*create the predicate node */
                XMLTriple predicate_triple = new XMLTriple("predicate",
                                                       "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                       "rdf");

                resource_att.clear();
                resource_att.add("rdf:resource",
                                 "http://biomodels.net/biology-qualifiers/occursIn");

                XMLToken predicate_token = new XMLToken(predicate_triple, resource_att);

                XMLNode predicate = new XMLNode(predicate_token);

                /*create the object node */
                XMLTriple object_triple = new XMLTriple("object",
                                                    "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
//.........这里部分代码省略.........
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:101,代码来源:addingEvidenceCodes_2.cs

示例6: test_XMLToken_newSetters_setAttributes2

 public void test_XMLToken_newSetters_setAttributes2()
 {
     int i ;
       XMLTriple triple = new  XMLTriple("test","","");
       XMLToken token = new  XMLToken(triple);
       XMLAttributes nattr = new  XMLAttributes();
       XMLTriple xt1 = new  XMLTriple("name1", "http://name1.org/", "p1");
       nattr.add(xt1, "val1");
       i = token.setAttributes(nattr);
       assertTrue( i == libsbml.LIBSBML_INVALID_XML_OPERATION );
       assertTrue( token.isAttributesEmpty() == true );
       nattr = null;
       triple = null;
       token = null;
       xt1 = null;
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:16,代码来源:TestXMLToken_newSetters.cs

示例7: test_XMLToken_newSetters_setAttributes1

 public void test_XMLToken_newSetters_setAttributes1()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       XMLAttributes nattr = new  XMLAttributes();
       XMLTriple xt1 = new  XMLTriple("name1", "http://name1.org/", "p1");
       nattr.add(xt1, "val1");
       int i = token.setAttributes(nattr);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.isAttributesEmpty() == false );
       nattr = null;
       attr = null;
       triple = null;
       token = null;
       xt1 = null;
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:17,代码来源:TestXMLToken_newSetters.cs

示例8: 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:alexholehouse,项目名称:SBMLIntegrator,代码行数:101,代码来源:TestXMLAttributesC.cs

示例9: test_XMLAttributes_remove1

 public void test_XMLAttributes_remove1()
 {
     XMLAttributes xa = new  XMLAttributes();
       XMLTriple xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
       int i = xa.add( "name1", "val1", "http://name1.org/", "p1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = xa.add(xt2, "val2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = xa.add( "noprefix", "val3");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = xa.add( "name4", "val4", "http://name4.org/", "p1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 4 );
       i = xa.remove(4);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       i = xa.remove(3);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 3 );
       i = xa.remove( "noprefix");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 2 );
       i = xa.remove(xt2);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 1 );
       i = xa.remove( "name1", "http://name1.org/");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 0 );
       xa = null;
       xt2 = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:30,代码来源:TestXMLAttributesC.cs

示例10: test_XMLToken_create

 public void test_XMLToken_create()
 {
     XMLToken token;
       XMLTriple triple;
       XMLAttributes attr;
       token = new  XMLToken();
       assertTrue( token != null );
       token = null;
       triple = new  XMLTriple("attr", "uri", "prefix");
       token = new  XMLToken(triple);
       assertTrue( token != null );
       assertTrue( (  "attr" != token.getName() ) == false );
       assertTrue( (  "prefix" != token.getPrefix() ) == false );
       assertTrue( (  "uri" != token.getURI() ) == false );
       token = null;
       attr = new  XMLAttributes();
       assertTrue( attr != null );
       attr.add( "attr2", "value");
       token = new  XMLToken(triple,attr);
       assertTrue( token != null );
       XMLAttributes returnattr = token.getAttributes();
       assertTrue( (  "attr2" != returnattr.getName(0) ) == false );
       token = null;
       triple = null;
       attr = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:26,代码来源:TestXMLToken.cs

示例11: test_XMLToken_attribute_set_clear

 public void test_XMLToken_attribute_set_clear()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       XMLAttributes nattr = 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 xt4 = new  XMLTriple("name4", "http://name4.org/", "p4");
       XMLTriple xt5 = new  XMLTriple("name5", "http://name5.org/", "p5");
       nattr.add(xt1, "val1");
       nattr.add(xt2, "val2");
       nattr.add(xt3, "val3");
       nattr.add(xt4, "val4");
       nattr.add(xt5, "val5");
       token.setAttributes(nattr);
       assertTrue( token.getAttributesLength() == 5 );
       assertTrue( token.isAttributesEmpty() == false );
       assertTrue( (  "name1" != token.getAttrName(0) ) == false );
       assertTrue( (  "val1"  != token.getAttrValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != token.getAttrURI(0) ) == false );
       assertTrue( (  "p1"    != token.getAttrPrefix(0) ) == false );
       assertTrue( (  "name2" != token.getAttrName(1) ) == false );
       assertTrue( (  "val2"  != token.getAttrValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != token.getAttrURI(1) ) == false );
       assertTrue( (  "p2"    != token.getAttrPrefix(1) ) == false );
       assertTrue( (  "name3" != token.getAttrName(2) ) == false );
       assertTrue( (  "val3"  != token.getAttrValue(2) ) == false );
       assertTrue( (  "http://name3.org/" != token.getAttrURI(2) ) == false );
       assertTrue( (  "p3"    != token.getAttrPrefix(2) ) == false );
       assertTrue( (  "name4" != token.getAttrName(3) ) == false );
       assertTrue( (  "val4"  != token.getAttrValue(3) ) == false );
       assertTrue( (  "http://name4.org/" != token.getAttrURI(3) ) == false );
       assertTrue( (  "p4"    != token.getAttrPrefix(3) ) == false );
       assertTrue( (  "name5" != token.getAttrName(4) ) == false );
       assertTrue( (  "val5"  != token.getAttrValue(4) ) == false );
       assertTrue( (  "http://name5.org/" != token.getAttrURI(4) ) == false );
       assertTrue( (  "p5"    != token.getAttrPrefix(4) ) == false );
       XMLTriple ntriple = new  XMLTriple("test2","http://test2.org/","p2");
       token.setTriple(ntriple);
       assertTrue( (    "test2" != token.getName() ) == false );
       assertTrue( (     "http://test2.org/" != token.getURI() ) == false );
       assertTrue( (  "p2" != token.getPrefix() ) == false );
       token.clearAttributes();
       assertTrue( token.getAttributesLength() == 0 );
       assertTrue( token.isAttributesEmpty() != false );
       nattr = null;
       triple = null;
       ntriple = null;
       attr = null;
       token = null;
       xt1 = null;
       xt2 = null;
       xt3 = null;
       xt4 = null;
       xt5 = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:58,代码来源:TestXMLToken.cs

示例12: test_XMLNode_getters

 public void test_XMLNode_getters()
 {
     XMLToken token;
       XMLNode node;
       XMLTriple triple;
       XMLAttributes attr;
       XMLNamespaces NS;
       NS = new  XMLNamespaces();
       NS.add( "http://test1.org/", "test1");
       token = new  XMLToken("This is a test");
       node = new XMLNode(token);
       assertTrue( node != null );
       assertTrue( node.getNumChildren() == 0 );
       assertTrue( (  "This is a test" != node.getCharacters() ) == false );
       assertTrue( node.getChild(1) != null );
       attr = new  XMLAttributes();
       assertTrue( attr != null );
       attr.add( "attr2", "value");
       triple = new  XMLTriple("attr", "uri", "prefix");
       token = new  XMLToken(triple,attr);
       assertTrue( token != null );
       node = new XMLNode(token);
       assertTrue( (  "attr" != node.getName() ) == false );
       assertTrue( (  "uri" != node.getURI() ) == false );
       assertTrue( (  "prefix" != node.getPrefix() ) == false );
       XMLAttributes returnattr = node.getAttributes();
       assertTrue( (  "attr2" != returnattr.getName(0) ) == false );
       assertTrue( (  "value" != returnattr.getValue(0) ) == false );
       token = new  XMLToken(triple,attr,NS);
       node = new XMLNode(token);
       XMLNamespaces returnNS = node.getNamespaces();
       assertTrue( returnNS.getLength() == 1 );
       assertTrue( returnNS.isEmpty() == false );
       triple = null;
       token = null;
       node = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:37,代码来源:TestXMLNode.cs

示例13: test_XMLNode_createElement

 public void test_XMLNode_createElement()
 {
     XMLTriple triple;
       XMLAttributes attr;
       XMLNamespaces ns;
       XMLNode snode, enode, tnode;
       XMLAttributes cattr;
       string name =  "test";
       string uri =  "http://test.org/";
       string prefix =  "p";
       string text =  "text node";
       triple = new  XMLTriple(name,uri,prefix);
       ns = new  XMLNamespaces();
       attr = new  XMLAttributes();
       ns.add(uri,prefix);
       attr.add("id", "value",uri,prefix);
       snode = new XMLNode(triple,attr,ns);
       assertTrue( snode != null );
       assertTrue( snode.getNumChildren() == 0 );
       assertTrue( ( name != snode.getName() ) == false );
       assertTrue( ( prefix != snode.getPrefix() ) == false );
       assertTrue( ( uri != snode.getURI() ) == false );
       assertTrue( snode.isElement() == true );
       assertTrue( snode.isStart() == true );
       assertTrue( snode.isEnd() == false );
       assertTrue( snode.isText() == false );
       snode.setEnd();
       assertTrue( snode.isEnd() == true );
       snode.unsetEnd();
       assertTrue( snode.isEnd() == false );
       cattr = snode.getAttributes();
       assertTrue( cattr != null );
       assertTrue( (  "id"    != cattr.getName(0) ) == false );
       assertTrue( (  "value" != cattr.getValue(0) ) == false );
       assertTrue( ( prefix != cattr.getPrefix(0) ) == false );
       assertTrue( ( uri != cattr.getURI(0) ) == false );
       triple = null;
       attr = null;
       ns = null;
       snode = null;
       attr = new  XMLAttributes();
       attr.add("id", "value");
       triple = new  XMLTriple(name, "", "");
       snode = new XMLNode(triple,attr);
       assertTrue( snode != null );
       assertTrue( snode.getNumChildren() == 0 );
       assertTrue( (  "test" != snode.getName() ) == false );
       assertTrue( snode.getPrefix() == "" );
       assertTrue( snode.getURI() == "" );
       assertTrue( snode.isElement() == true );
       assertTrue( snode.isStart() == true );
       assertTrue( snode.isEnd() == false );
       assertTrue( snode.isText() == false );
       cattr = snode.getAttributes();
       assertTrue( cattr != null );
       assertTrue( (  "id"    != cattr.getName(0) ) == false );
       assertTrue( (  "value" != cattr.getValue(0) ) == false );
       assertTrue( cattr.getPrefix(0) == "" );
       assertTrue( cattr.getURI(0) == "" );
       enode = new XMLNode(triple);
       assertTrue( enode != null );
       assertTrue( enode.getNumChildren() == 0 );
       assertTrue( (  "test" != enode.getName() ) == false );
       assertTrue( enode.getPrefix() == "" );
       assertTrue( enode.getURI() == "" );
       assertTrue( enode.isElement() == true );
       assertTrue( enode.isStart() == false );
       assertTrue( enode.isEnd() == true );
       assertTrue( enode.isText() == false );
       tnode = new XMLNode(text);
       assertTrue( tnode != null );
       assertTrue( ( text != tnode.getCharacters() ) == false );
       assertTrue( tnode.getNumChildren() == 0 );
       assertTrue( tnode.getName() == "" );
       assertTrue( tnode.getPrefix() == "" );
       assertTrue( tnode.getURI() == "" );
       assertTrue( tnode.isElement() == false );
       assertTrue( tnode.isStart() == false );
       assertTrue( tnode.isEnd() == false );
       assertTrue( tnode.isText() == true );
       triple = null;
       attr = null;
       snode = null;
       enode = null;
       tnode = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:86,代码来源:TestXMLNode.cs


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