本文整理汇总了C#中libsbmlcs.XMLNode类的典型用法代码示例。如果您正苦于以下问题:C# XMLNode类的具体用法?C# XMLNode怎么用?C# XMLNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLNode类属于libsbmlcs命名空间,在下文中一共展示了XMLNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test_XMLNode_clearAttributes
public void test_XMLNode_clearAttributes()
{
XMLTriple triple = new XMLTriple("test","","");
XMLAttributes attr = new XMLAttributes();
XMLNode node = new XMLNode(triple,attr);
XMLTriple xt2 = new XMLTriple("name3", "http://name3.org/", "p3");
XMLTriple xt1 = new XMLTriple("name5", "http://name5.org/", "p5");
int i = node.addAttr( "name1", "val1");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getAttributes().getLength() == 1 );
i = node.addAttr( "name2", "val2", "http://name1.org/", "p1");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getAttributes().getLength() == 2 );
i = node.addAttr(xt2, "val2");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getAttributes().getLength() == 3 );
i = node.addAttr( "name4", "val4");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getAttributes().getLength() == 4 );
i = node.clearAttributes();
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getAttributes().getLength() == 0 );
xt1 = null;
xt2 = null;
triple = null;
attr = null;
node = null;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: test_ASTNode_addSemanticsAnnotation
public void test_ASTNode_addSemanticsAnnotation()
{
XMLNode ann = new XMLNode();
ASTNode node = new ASTNode();
int i = 0;
i = node.addSemanticsAnnotation(ann);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getNumSemanticsAnnotations() == 1 );
i = node.addSemanticsAnnotation(null);
assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
assertTrue( node.getNumSemanticsAnnotations() == 1 );
node = null;
}
示例6: 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;
}
示例7: test_Constraint_setMessage1
public void test_Constraint_setMessage1()
{
XMLNode node = new XMLNode();
int i = C.setMessage(node);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertTrue( C.isSetMessage() == false );
i = C.unsetMessage();
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertEquals( false, C.isSetMessage() );
if (C.getMessage() != null);
{
}
node = null;
}
示例8: 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 );
}
示例9: 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;
}
示例10: equals
/**
* Compare this XMLNode against another XMLNode returning true if both
* nodes represent the same XML tree, or false otherwise.
*
* @param other another XMLNode to compare against.
*
* @param ignoreURI whether to ignore the namespace URI when doing the
* comparison.
*
* @return bool indicating whether this XMLNode represents the same XML
* tree as another.
*/
public bool equals(XMLNode other)
{
bool ret = libsbmlPINVOKE.XMLNode_equals__SWIG_1(swigCPtr, XMLNode.getCPtr(other));
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
示例11: addChild
/**
* Adds a copy of @p node as a child of this XMLNode.
*
* The given @p node is added at the end of the list of children.
*
* @param node the XMLNode to be added as child.
*
* @return integer value indicating success/failure of the
* function. The possible values
* returned by this function are:
* @li @link libsbmlcs#LIBSBML_OPERATION_SUCCESS [email protected]
* @li @link libsbmlcs#LIBSBML_INVALID_XML_OPERATION [email protected]
*
* @note The given node is added at the end of the children list.
*/
public int addChild(XMLNode node)
{
int ret = libsbmlPINVOKE.XMLNode_addChild(swigCPtr, XMLNode.getCPtr(node));
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
示例12: convertXMLNodeToString
/**
* Returns a string representation of a given XMLNode.
*
* @param node the XMLNode to be represented as a string
*
* @return a string-form representation of @p node
*/
public static string convertXMLNodeToString(XMLNode node)
{
string ret = libsbmlPINVOKE.XMLNode_convertXMLNodeToString(XMLNode.getCPtr(node));
return ret;
}
示例13: XMLNode
/**
* Copy constructor; creates a copy of this XMLNode.
*
* @param orig the XMLNode instance to copy.
*
* @throws XMLConstructorException
* Thrown if the argument @p orig is @c null.
*/
public XMLNode(XMLNode orig)
: this(libsbmlPINVOKE.new_XMLNode__SWIG_15(XMLNode.getCPtr(orig)), true)
{
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
}
示例14: setAnnotation
/**
* Sets the value of the 'annotation' subelement of this SBML object to a
* copy of @p annotation.
*
* Any existing content of the 'annotation' subelement is discarded.
* Unless you have taken steps to first copy and reconstitute any
* existing annotations into the @p annotation that is about to be
* assigned, it is likely that performing such wholesale replacement is
* unfriendly towards other software applications whose annotations are
* discarded. An alternative may be to use appendAnnotation().
*
* @param annotation an XML structure that is to be used as the content
* of the 'annotation' subelement of this object
*
*
* @return integer value indicating success/failure of the
* function. @if clike The value is drawn from the
* enumeration #OperationReturnValues_t. @endif The possible values
* returned by this function are:
* @li @link libsbml#LIBSBML_OPERATION_SUCCESS [email protected]
*
* @see appendAnnotation(XMLNode annotation)
*/
public new int setAnnotation(XMLNode annotation)
{
int ret = libsbmlPINVOKE.Model_setAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
return ret;
}
示例15: appendAnnotation
/**
* Appends the given @p annotation to the 'annotation' subelement of this
* object.
*
* Whereas the SBase 'notes' subelement is a container for content to be
* shown directly to humans, the 'annotation' element is a container for
* optional software-generated content @em not meant to be shown to
* humans. Every object derived from SBase can have its own value for
* 'annotation'. The element's content type is <a
* target='_blank'
* href='http://www.w3.org/TR/2004/REC-xml-20040204/#elemdecls'>XML type 'any'</a>,
* allowing essentially arbitrary well-formed XML data content.
*
* SBML places a few restrictions on the organization of the content of
* annotations; these are intended to help software tools read and write
* the data as well as help reduce conflicts between annotations added by
* different tools. Please see the SBML specifications for more details.
*
* Unlike SBase::setAnnotation(XMLNode annotation) or
* SBase::setAnnotation(string annotation), this method
* allows other annotations to be preserved when an application adds its
* own data.
*
* @param annotation an XML structure that is to be copied and appended
* to the content of the 'annotation' subelement of this object
*
* @return integer value indicating success/failure of the
* function. The possible values returned by this function are:
* @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS @endlink
* @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED @endlink
*
* @see getAnnotationString()
* @see isSetAnnotation()
* @see setAnnotation(XMLNode annotation)
* @see setAnnotation(string annotation)
* @see appendAnnotation(string annotation)
* @see unsetAnnotation()
*/
public int appendAnnotation(XMLNode annotation)
{
int ret = libsbmlPINVOKE.SBase_appendAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
return ret;
}