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


C# XMLNode.addChild方法代码示例

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


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

示例1: test_Node_clone

 public void test_Node_clone()
 {
     XMLAttributes att = new XMLAttributes();
       XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");
       XMLToken token = new XMLToken(t,att,3,4);
       XMLNode node = new XMLNode(token);
       XMLNode child = new XMLNode();
       node.addChild(child);
       assertTrue( node.getNumChildren() == 1 );
       assertTrue( node.getName() ==  "sarah" );
       assertTrue( node.getURI() ==  "http://foo.org/" );
       assertTrue( node.getPrefix() ==  "bar" );
       assertTrue( node.isEnd() == false );
       assertTrue( node.isEOF() == false );
       assertTrue( node.getLine() == 3 );
       assertTrue( node.getColumn() == 4 );
       XMLNode node2 = (XMLNode) node.clone();
       assertTrue( node2.getNumChildren() == 1 );
       assertTrue( node2.getName() ==  "sarah" );
       assertTrue( node2.getURI() ==  "http://foo.org/" );
       assertTrue( node2.getPrefix() ==  "bar" );
       assertTrue( node2.isEnd() == false );
       assertTrue( node2.isEOF() == false );
       assertTrue( node2.getLine() == 3 );
       assertTrue( node2.getColumn() == 4 );
       t = null;
       token = null;
       node = null;
       node2 = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:30,代码来源:TestCopyAndClone.cs

示例2: test_XMLNode_addChild1

 public void test_XMLNode_addChild1()
 {
     XMLNode node = new XMLNode();
       XMLNode node2 = new XMLNode();
       int i = node.addChild(node2);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 1 );
       node = null;
       node2 = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:10,代码来源:TestXMLNode_newSetters.cs

示例3: test_XMLNode_addChild3

 public void test_XMLNode_addChild3()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLNode node = new XMLNode(triple);
       XMLNode node2 = new XMLNode();
       int i = node.addChild(node2);
       assertTrue( i == libsbml.LIBSBML_INVALID_XML_OPERATION );
       assertTrue( node.getNumChildren() == 0 );
       triple = null;
       node = null;
       node2 = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:12,代码来源:TestXMLNode_newSetters.cs

示例4: test_XMLNode_addChild2

 public void test_XMLNode_addChild2()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLNode node2 = new XMLNode();
       int i = node.addChild(node2);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 1 );
       triple = null;
       attr = null;
       node = null;
       node2 = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:14,代码来源:TestXMLNode_newSetters.cs

示例5: test_SyntaxChecker_validXHTML

 public void test_SyntaxChecker_validXHTML()
 {
     SBMLNamespaces NS24 = new  SBMLNamespaces(2,4);
       SBMLNamespaces NS31 = new  SBMLNamespaces(3,1);
       XMLToken toptoken;
       XMLNode topnode;
       XMLTriple toptriple = new  XMLTriple("notes", "", "");
       XMLToken token;
       XMLNode node;
       XMLTriple triple = new  XMLTriple("p", "", "");
       XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLToken tt = new  XMLToken("This is my text");
       XMLNode n1 = new XMLNode(tt);
       toptoken = new  XMLToken(toptriple,att);
       topnode = new XMLNode(toptoken);
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(n1);
       topnode.addChild(node);
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(topnode,null) == true );
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(topnode,NS24) == true );
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(topnode,NS31) == true );
       triple = new  XMLTriple("html", "", "");
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(n1);
       topnode.removeChild(0);
       topnode.addChild(node);
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(topnode,null) == true );
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(topnode,NS24) == false );
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(topnode,NS31) == true );
       triple = new  XMLTriple("html", "", "");
       ns.clear();
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(n1);
       topnode.removeChild(0);
       topnode.addChild(node);
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(topnode,null) == false );
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(topnode,NS24) == false );
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(topnode,NS31) == false );
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:44,代码来源:TestSyntaxChecker.cs

示例6: 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

示例7: test_SBase_appendNotes8

 public void test_SBase_appendNotes8()
 {
     XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLTriple body_triple = new  XMLTriple("body", "", "");
       XMLTriple p_triple = new  XMLTriple("p", "", "");
       XMLToken body_token = new  XMLToken(body_triple,att,ns);
       XMLToken p_token = new  XMLToken(p_triple,att);
       XMLToken text_token = new  XMLToken("This is my text");
       XMLNode body_node = new XMLNode(body_token);
       XMLNode p_node = new XMLNode(p_token);
       XMLNode text_node = new XMLNode(text_token);
       XMLToken p_token1 = new  XMLToken(p_triple,att,ns);
       XMLToken text_token1 = new  XMLToken("This is more text");
       XMLNode p_node1 = new XMLNode(p_token1);
       XMLNode text_node1 = new XMLNode(text_token1);
       XMLNode notes;
       XMLNode child, child1;
       p_node.addChild(text_node);
       body_node.addChild(p_node);
       p_node1.addChild(text_node1);
       int i = S.setNotes(body_node);
       i = S.appendNotes(p_node1);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       notes = S.getNotes();
       assertTrue((  "notes" == notes.getName() ));
       assertTrue( notes.getNumChildren() == 1 );
       child = notes.getChild(0);
       assertTrue((  "body" == child.getName() ));
       assertTrue( child.getNumChildren() == 2 );
       child1 = child.getChild(0);
       assertTrue((  "p" == child1.getName() ));
       assertTrue( child1.getNumChildren() == 1 );
       child1 = child1.getChild(0);
       assertTrue((  "This is my text" == child1.getCharacters() ));
       assertTrue( child1.getNumChildren() == 0 );
       child1 = child.getChild(1);
       assertTrue((  "p" == child1.getName() ));
       assertTrue( child1.getNumChildren() == 1 );
       child1 = child1.getChild(0);
       assertTrue((  "This is more text" == child1.getCharacters() ));
       assertTrue( child1.getNumChildren() == 0 );
       att = null;
       ns = null;
       body_triple = null;
       p_triple = null;
       body_token = null;
       p_token = null;
       text_token = null;
       text_token1 = null;
       p_token1 = null;
       body_node = null;
       p_node = null;
       text_node = null;
       p_node1 = null;
       text_node1 = null;
 }
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:58,代码来源:TestSBase_newSetters.cs

示例8: test_SBase_appendNotes

 public void test_SBase_appendNotes()
 {
     XMLToken token;
       XMLNode node;
       XMLToken token1;
       XMLNode node1;
       XMLNode node2;
       XMLTriple triple = new  XMLTriple("p", "", "");
       XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLToken token4 = new  XMLToken("This is my text");
       XMLNode node4 = new XMLNode(token4);
       XMLToken token5 = new  XMLToken("This is additional text");
       XMLNode node5 = new XMLNode(token5);
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(node4);
       int i = S.setNotes(node);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( S.isSetNotes() == true );
       token1 = new  XMLToken(triple,att,ns);
       node1 = new XMLNode(token1);
       node1.addChild(node5);
       i = S.appendNotes(node1);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( S.isSetNotes() == true );
       node2 = S.getNotes();
       assertTrue( node2.getNumChildren() == 2 );
       assertTrue((  "p" == node2.getChild(0).getName() ));
       assertTrue( node2.getChild(0).getNumChildren() == 1 );
       assertTrue((  "p" == node2.getChild(1).getName() ));
       assertTrue( node2.getChild(1).getNumChildren() == 1 );
       string chars1 = node2.getChild(0).getChild(0).getCharacters();
       string chars2 = node2.getChild(1).getChild(0).getCharacters();
       assertTrue((  "This is my text" == chars1 ));
       assertTrue((  "This is additional text" == chars2 ));
       node = null;
       node1 = null;
 }
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:40,代码来源:TestSBase_newSetters.cs

示例9: test_SBase_appendAnnotationString

 public void test_SBase_appendAnnotationString()
 {
     XMLToken token;
       XMLNode node;
       token = new  XMLToken("This is a test note");
       node = new XMLNode(token);
       XMLToken token_top;
       XMLNode node_top;
       XMLTriple triple = new XMLTriple("any", "", "pr");
       XMLAttributes att = new XMLAttributes();
       XMLNamespaces ns = new XMLNamespaces();
       ns.add("http://www.any", "pr");
       token_top = new XMLToken(triple, att, ns);
       node_top = new XMLNode(token_top);
       node_top.addChild(node);
       int i = S.setAnnotation(node_top);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = S.appendAnnotation("<prA:other xmlns:prA=\"http://some\">This is additional</prA:other>");
       XMLNode t1 = S.getAnnotation();
       assertTrue( t1.getNumChildren() == 2 );
       assertTrue((     "This is a test note" == t1.getChild(0).getChild(0).getCharacters() ));
       XMLNode c1 = t1.getChild(1);
       assertTrue( c1.getNumChildren() == 1 );
       assertTrue((  "This is additional" == c1.getChild(0).getCharacters() ));
 }
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:25,代码来源:TestSBase_newSetters.cs

示例10: test_SBase_setNotes1

 public void test_SBase_setNotes1()
 {
     XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLTriple html_triple = new  XMLTriple("html", "", "");
       XMLTriple head_triple = new  XMLTriple("head", "", "");
       XMLTriple title_triple = new  XMLTriple("title", "", "");
       XMLTriple body_triple = new  XMLTriple("body", "", "");
       XMLTriple p_triple = new  XMLTriple("p", "", "");
       XMLToken html_token = new  XMLToken(html_triple,att,ns);
       XMLToken head_token = new  XMLToken(head_triple,att);
       XMLToken title_token = new  XMLToken(title_triple,att);
       XMLToken body_token = new  XMLToken(body_triple,att);
       XMLToken p_token = new  XMLToken(p_triple,att);
       XMLToken text_token = new  XMLToken("This is my text");
       XMLNode html_node = new XMLNode(html_token);
       XMLNode head_node = new XMLNode(head_token);
       XMLNode title_node = new XMLNode(title_token);
       XMLNode body_node = new XMLNode(body_token);
       XMLNode p_node = new XMLNode(p_token);
       XMLNode text_node = new XMLNode(text_token);
       XMLNode notes;
       XMLNode child;
       p_node.addChild(text_node);
       body_node.addChild(p_node);
       head_node.addChild(title_node);
       html_node.addChild(head_node);
       html_node.addChild(body_node);
       int i = S.setNotes(html_node);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       notes = S.getNotes();
       assertTrue((  "notes" == notes.getName() ));
       assertTrue( notes.getNumChildren() == 1 );
       child = notes.getChild(0);
       assertTrue((  "html" == child.getName() ));
       assertTrue( child.getNumChildren() == 2 );
       child = child.getChild(1);
       assertTrue((  "body" == child.getName() ));
       assertTrue( child.getNumChildren() == 1 );
       child = child.getChild(0);
       assertTrue((  "p" == child.getName() ));
       assertTrue( child.getNumChildren() == 1 );
       child = child.getChild(0);
       assertTrue((  "This is my text" == child.getCharacters() ));
       assertTrue( child.getNumChildren() == 0 );
       att = null;
       ns = null;
       html_triple = null;
       head_triple = null;
       body_triple = null;
       p_triple = null;
       html_token = null;
       head_token = null;
       body_token = null;
       p_token = null;
       text_token = null;
       html_node = null;
       head_node = null;
       body_node = null;
       p_node = null;
       text_node = null;
 }
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:63,代码来源:TestSBase_newSetters.cs

示例11: test_SBase_setNotes

 public void test_SBase_setNotes()
 {
     XMLToken token;
       XMLNode node;
       XMLTriple triple = new  XMLTriple("p", "", "");
       XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLToken tt = new  XMLToken("This is my text");
       XMLNode n1 = new XMLNode(tt);
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(n1);
       int i = S.setNotes(node);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( S.isSetNotes() == true );
       i = S.unsetNotes();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( S.isSetNotes() == false );
       token = new  XMLToken("This is a test note");
       node = new XMLNode(token);
       i = S.setNotes(node);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertTrue( S.isSetNotes() == false );
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(n1);
       i = S.setNotes(node);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( S.isSetNotes() == true );
       i = S.setNotes((XMLNode)null);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( S.isSetNotes() == false );
       node = null;
 }
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:35,代码来源:TestSBase_newSetters.cs

示例12: test_WriteSBML_Constraint_full

 public void test_WriteSBML_Constraint_full()
 {
     D.setLevelAndVersion(2,2,false);
       string expected = "<constraint sboTerm=\"SBO:0000064\">\n" +
     "  <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" +
     "    <apply>\n" +
     "      <leq/>\n" +
     "      <ci> P1 </ci>\n" +
     "      <ci> t </ci>\n" +
     "    </apply>\n" +
     "  </math>\n" +
     "  <message>\n" +
     "    <p xmlns=\"http://www.w3.org/1999/xhtml\"> Species P1 is out of range </p>\n" +
     "  </message>\n" +
     "</constraint>";
       Constraint c = D.createModel().createConstraint();
       ASTNode node = libsbml.parseFormula("leq(P1,t)");
       c.setMath(node);
       c.setSBOTerm(64);
       XMLNode text = XMLNode.convertStringToXMLNode(" Species P1 is out of range ");
       XMLTriple triple = new XMLTriple("p", "http://www.w3.org/1999/xhtml", "");
       XMLAttributes att = new XMLAttributes();
       XMLNamespaces xmlns = new XMLNamespaces();
       xmlns.add("http://www.w3.org/1999/xhtml");
       XMLNode p = new XMLNode(triple,att,xmlns);
       p.addChild(text);
       XMLTriple triple1 = new XMLTriple("message", "", "");
       XMLAttributes att1 = new XMLAttributes();
       XMLNode message = new XMLNode(triple1,att1);
       message.addChild(p);
       c.setMessage(message);
       assertEquals( true, equals(expected,c.toSBML()) );
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:33,代码来源:TestWriteSBML.cs

示例13: test_XMLNode_insert

 public void test_XMLNode_insert()
 {
     XMLAttributes attr = new  XMLAttributes();
       XMLTriple trp_p = new  XMLTriple("parent","","");
       XMLTriple trp_c1 = new  XMLTriple("child1","","");
       XMLTriple trp_c2 = new  XMLTriple("child2","","");
       XMLTriple trp_c3 = new  XMLTriple("child3","","");
       XMLTriple trp_c4 = new  XMLTriple("child4","","");
       XMLTriple trp_c5 = new  XMLTriple("child5","","");
       XMLNode p = new XMLNode(trp_p,attr);
       XMLNode c1 = new XMLNode(trp_c1,attr);
       XMLNode c2 = new XMLNode(trp_c2,attr);
       XMLNode c3 = new XMLNode(trp_c3,attr);
       XMLNode c4 = new XMLNode(trp_c4,attr);
       XMLNode c5 = new XMLNode(trp_c5,attr);
       p.addChild(c2);
       p.addChild(c4);
       p.insertChild(0,c1);
       p.insertChild(2,c3);
       p.insertChild(4,c5);
       assertTrue( p.getNumChildren() == 5 );
       assertTrue( (  "child1" != p.getChild(0).getName() ) == false );
       assertTrue( (  "child2" != p.getChild(1).getName() ) == false );
       assertTrue( (  "child3" != p.getChild(2).getName() ) == false );
       assertTrue( (  "child4" != p.getChild(3).getName() ) == false );
       assertTrue( (  "child5" != p.getChild(4).getName() ) == false );
       p.removeChildren();
       p.insertChild(0,c1);
       p.insertChild(0,c2);
       p.insertChild(0,c3);
       p.insertChild(0,c4);
       p.insertChild(0,c5);
       assertTrue( p.getNumChildren() == 5 );
       assertTrue( (  "child5" != p.getChild(0).getName() ) == false );
       assertTrue( (  "child4" != p.getChild(1).getName() ) == false );
       assertTrue( (  "child3" != p.getChild(2).getName() ) == false );
       assertTrue( (  "child2" != p.getChild(3).getName() ) == false );
       assertTrue( (  "child1" != p.getChild(4).getName() ) == false );
       p.removeChildren();
       p.insertChild(1,c1);
       p.insertChild(2,c2);
       p.insertChild(3,c3);
       p.insertChild(4,c4);
       p.insertChild(5,c5);
       assertTrue( p.getNumChildren() == 5 );
       assertTrue( (  "child1" != p.getChild(0).getName() ) == false );
       assertTrue( (  "child2" != p.getChild(1).getName() ) == false );
       assertTrue( (  "child3" != p.getChild(2).getName() ) == false );
       assertTrue( (  "child4" != p.getChild(3).getName() ) == false );
       assertTrue( (  "child5" != p.getChild(4).getName() ) == false );
       p.removeChildren();
       XMLNode tmp;
       tmp = p.insertChild(0,c1);
       assertTrue( ( "child1" != tmp.getName() ) == false );
       tmp = p.insertChild(0,c2);
       assertTrue( ( "child2" != tmp.getName() ) == false );
       tmp = p.insertChild(0,c3);
       assertTrue( ( "child3" != tmp.getName() ) == false );
       tmp = p.insertChild(0,c4);
       assertTrue( ( "child4" != tmp.getName() ) == false );
       tmp = p.insertChild(0,c5);
       assertTrue( ( "child5" != tmp.getName() ) == false );
       p.removeChildren();
       tmp = p.insertChild(1,c1);
       assertTrue( ( "child1" != tmp.getName() ) == false );
       tmp = p.insertChild(2,c2);
       assertTrue( ( "child2" != tmp.getName() ) == false );
       tmp = p.insertChild(3,c3);
       assertTrue( ( "child3" != tmp.getName() ) == false );
       tmp = p.insertChild(4,c4);
       assertTrue( ( "child4" != tmp.getName() ) == false );
       tmp = p.insertChild(5,c5);
       assertTrue( ( "child5" != tmp.getName() ) == false );
       p = null;
       c1 = null;
       c2 = null;
       c3 = null;
       c4 = null;
       c5 = null;
       attr = null;
       trp_p = null;
       trp_c1 = null;
       trp_c2 = null;
       trp_c3 = null;
       trp_c4 = null;
       trp_c5 = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:87,代码来源:TestXMLNode.cs

示例14: test_SBase_appendAnnotation

 public void test_SBase_appendAnnotation()
 {
     XMLToken token;
       XMLNode node;
       XMLToken token1;
       XMLNode node1;
       XMLToken token_top;
       XMLNode node_top;
       XMLTriple triple = new XMLTriple("any", "", "pr");
       XMLAttributes att = new XMLAttributes();
       XMLNamespaces ns = new XMLNamespaces();
       ns.add("http://www.any", "pr");
       XMLToken token_top1;
       XMLNode node_top1;
       XMLTriple triple1 = new XMLTriple("anyOther", "", "prOther");
       XMLNamespaces ns1 = new XMLNamespaces();
       ns1.add("http://www.any.other", "prOther");
       token = new XMLToken("This is a test note");
       node = new XMLNode(token);
       token1 = new  XMLToken("This is additional");
       node1 = new XMLNode(token1);
       token_top = new XMLToken(triple, att, ns);
       node_top = new XMLNode(token_top);
       node_top.addChild(node);
       token_top1 = new XMLToken(triple1, att, ns1);
       node_top1 = new XMLNode(token_top1);
       node_top1.addChild(node1);
       int i = S.setAnnotation(node_top);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = S.appendAnnotation(node_top1);
       XMLNode t1 = S.getAnnotation();
       assertTrue( t1.getNumChildren() == 2 );
       assertTrue((     "This is a test note" == t1.getChild(0).getChild(0).getCharacters() ));
       assertTrue((     "This is additional" == t1.getChild(1).getChild(0).getCharacters() ));
 }
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:35,代码来源:TestSBase_newSetters.cs

示例15: test_SBase_appendNotes5

 public void test_SBase_appendNotes5()
 {
     XMLAttributes att = new XMLAttributes ();
     XMLNamespaces ns = new XMLNamespaces ();
     [email protected] ("http://www.w3.org/1999/xhtml", "");
     XMLTriple html_triple = new XMLTriple ("html", "", "");
     XMLTriple head_triple = new XMLTriple ("head", "", "");
     XMLTriple title_triple = new XMLTriple ("title", "", "");
     XMLTriple body_triple = new XMLTriple ("body", "", "");
     XMLTriple p_triple = new XMLTriple ("p", "", "");
     XMLToken html_token = new XMLToken (html_triple, att, ns);
     XMLToken head_token = new XMLToken (head_triple, att);
     XMLToken title_token = new XMLToken (title_triple, att);
     XMLToken body_token = new XMLToken (body_triple, att);
     XMLToken p_token = new XMLToken (p_triple, att);
     XMLToken p_token1 = new XMLToken (p_triple, att, ns);
     XMLToken text_token = new XMLToken ("This is my text");
     XMLNode p_node = new XMLNode (p_token1);
     XMLNode text_node = new XMLNode (text_token);
     XMLToken text_token1 = new XMLToken ("This is more text");
     XMLNode html_node1 = new XMLNode (html_token);
     XMLNode head_node1 = new XMLNode (head_token);
     XMLNode title_node1 = new XMLNode (title_token);
     XMLNode body_node1 = new XMLNode (body_token);
     XMLNode p_node1 = new XMLNode (p_token);
     XMLNode text_node1 = new XMLNode (text_token1);
     XMLNode notes;
     XMLNode child, child1;
     p_node.addChild (text_node);
     p_node1.addChild (text_node1);
     body_node1.addChild (p_node1);
     head_node1.addChild (title_node1);
     html_node1.addChild (head_node1);
     html_node1.addChild (body_node1);
     S.setNotes (p_node);
     S.appendNotes (html_node1);
     notes = S.getNotes ();
     assertTrue (("notes" == notes.getName ()));
     assertTrue (notes.getNumChildren () == 1);
     child = notes.getChild (0);
     assertTrue (("html" == child.getName ()));
     assertTrue (child.getNumChildren () == 2);
     child = child.getChild (1);
     assertTrue (("body" == child.getName ()));
     assertTrue (child.getNumChildren () == 2);
     child1 = child.getChild (0);
     assertTrue (("p" == child1.getName ()));
     assertTrue (child1.getNumChildren () == 1);
     child1 = child1.getChild (0);
     assertTrue (("This is my text" == child1.getCharacters ()));
     assertTrue (child1.getNumChildren () == 0);
     child1 = child.getChild (1);
     assertTrue (("p" == child1.getName ()));
     assertTrue (child1.getNumChildren () == 1);
     child1 = child1.getChild (0);
     assertTrue (("This is more text" == child1.getCharacters ()));
     assertTrue (child1.getNumChildren () == 0);
     att = null;
     ns = null;
     html_triple = null;
     head_triple = null;
     body_triple = null;
     p_triple = null;
     body_token = null;
     p_token = null;
     p_token1 = null;
     text_token = null;
     text_token1 = null;
     p_node = null;
     text_node = null;
     html_node1 = null;
     head_node1 = null;
     body_node1 = null;
     p_node1 = null;
     text_node1 = null;
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:76,代码来源:TestSBase.cs


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