本文整理汇总了C#中libsbml.XMLNode类的典型用法代码示例。如果您正苦于以下问题:C# XMLNode类的具体用法?C# XMLNode怎么用?C# XMLNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLNode类属于libsbml命名空间,在下文中一共展示了XMLNode类的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;
}
示例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;
}
示例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;
}
示例4: 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;
}
示例5: 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;
}
示例6: test_SyntaxChecker_validXHTML
public void test_SyntaxChecker_validXHTML()
{
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);
assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(node,null) == false );
triple = new XMLTriple("html", "", "");
ns.clear();
token = new XMLToken(triple,att,ns);
node = new XMLNode(token);
node.addChild(n1);
assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(node,null) == false );
}
示例7: 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;
}
示例8: test_SBase_setNotes
public void test_SBase_setNotes()
{
SBase c = new Model(1,2);
XMLToken token;
XMLNode node;
token = new XMLToken("This is a test note");
node = new XMLNode(token);
c.setNotes(node);
assertTrue( c.isSetNotes() == true );
if (c.getNotes() == node);
{
}
XMLNode t1 = c.getNotes();
assertTrue( t1.getNumChildren() == 1 );
assertTrue(( "This is a test note" == t1.getChild(0).getCharacters() ));
c.setNotes(c.getNotes());
t1 = c.getNotes();
assertTrue( t1.getNumChildren() == 1 );
string chars = t1.getChild(0).getCharacters();
assertTrue(( "This is a test note" == chars ));
c.setNotes((XMLNode)null);
assertTrue( c.isSetNotes() == false );
if (c.getNotes() != null);
{
}
c.setNotes(node);
assertTrue( c.isSetNotes() == true );
token = new XMLToken("(CR) ¨ ¨ ¨ (NOT CR) &#; &#x; �a8; ¨ ¨");
node = new XMLNode(token);
c.setNotes(node);
t1 = c.getNotes();
assertTrue( t1.getNumChildren() == 1 );
string s = t1.getChild(0).toXMLString();
string expected = "(CR) ¨ ¨ ¨ (NOT CR) &#; &#x; &#00a8; &#0168 &#x00a8";
assertTrue(( expected == s ));
token = new XMLToken("& ' > < \" & ' > < "");
node = new XMLNode(token);
c.setNotes(node);
t1 = c.getNotes();
assertTrue( t1.getNumChildren() == 1 );
string s2 = t1.getChild(0).toXMLString();
string expected2 = "& ' > < " & ' > < "";
assertTrue(( expected2 == s2 ));
token = null;
node = null;
}
示例9: 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);
S.setNotes(body_node);
S.appendNotes(p_node1);
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;
}
示例10: hasExpectedXHTMLSyntax
public static bool hasExpectedXHTMLSyntax(XMLNode xhtml)
{
bool ret = libsbmlPINVOKE.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_1(XMLNode.getCPtr(xhtml));
return ret;
}
示例11: 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);
S.setNotes(node);
assertTrue( S.isSetNotes() == true );
token1 = new XMLToken(triple,att,ns);
node1 = new XMLNode(token1);
node1.addChild(node5);
S.appendNotes(node1);
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;
}
示例12: getCPtrAndDisown
internal static HandleRef getCPtrAndDisown(XMLNode obj)
{
HandleRef ptr = new HandleRef(null, IntPtr.Zero);
if (obj != null)
{
ptr = obj.swigCPtr;
obj.swigCMemOwn = false;
}
return ptr;
}
示例13: appendNotes
/**
* Appends the given @p notes to the 'notes' subelement of this object.
*
* The content of @p notes is copied.
*
* The optional SBML element named 'notes', present on every major SBML
* component type, is intended as a place for storing optional
* information intended to be seen by humans. An example use of the
* 'notes' element would be to contain formatted user comments about the
* model element in which the 'notes' element is enclosed. Every object
* derived directly or indirectly from type SBase can have a separate
* value for 'notes', allowing users considerable freedom when adding
* comments to their models.
*
* The format of 'notes' elements must be <a target='_blank'
* href='http://www.w3.org/TR/xhtml1/'>XHTML 1.0</a>. To help
* verify the formatting of 'notes' content, libSBML provides the static
* utility method SyntaxChecker::hasExpectedXHTMLSyntax(@if java [email protected]); however,
* readers are urged to consult the appropriate <a target='_blank'
* href='http://sbml.org/Documents/Specifications'>SBML specification
* document</a> for the Level and Version of their model for more
* in-depth explanations. The SBML Level 2 and 3
* specifications have considerable detail about how 'notes' element
* content must be structured.
*
* @param notes an XML node structure that is to appended to the content
* of the 'notes' 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]
* @li @link libsbml#LIBSBML_INVALID_OBJECT [email protected]
* @li @link libsbml#LIBSBML_OPERATION_FAILED [email protected]
*
* @see getNotesString()
* @see isSetNotes()
* @see setNotes(XMLNode notes)
* @see setNotes(string notes, bool addXHTMLMarkup)
* @see appendNotes(string notes)
* @see unsetNotes()
* @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java [email protected])
*/
public int appendNotes(XMLNode notes)
{
int ret = libsbmlPINVOKE.SBase_appendNotes__SWIG_0(swigCPtr, XMLNode.getCPtr(notes));
return ret;
}
示例14: replaceTopLevelAnnotationElement
/**
* Replaces the given top-level element within the 'annotation'
* subelement of this SBML object and with the annotation element supplied.
*
* 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.
*
* This method determines the name of the element to be replaced from the
* annotation argument. Functionally it is equivalent to calling <code>
* removeTopLevelAnnotationElement(name)</code> followed by calling
* <code>appendAnnotation(annotation_with_name)</code>, with the exception
* that the placement of the annotation element remains the same.
*
* @param annotation XMLNode representing the replacement top level annotation
*
*
* @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]
* @li @link libsbml#LIBSBML_OPERATION_FAILED [email protected]
* @li @link libsbml#LIBSBML_INVALID_OBJECT [email protected]
*
* @see removeTopLevelAnnotationElement(string elementName, string elementURI, bool removeEmpty)
* @see replaceTopLevelAnnotationElement(string)
*/
public int replaceTopLevelAnnotationElement(XMLNode annotation)
{
int ret = libsbmlPINVOKE.SBase_replaceTopLevelAnnotationElement__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
return ret;
}
示例15: CVTerm
/**
* Creates a new CVTerm from the given XMLNode.
*
*
*
* The SBML Level 2 and Level 3 specifications define a simple
* format for annotating models when (a) referring to controlled
* vocabulary terms and database identifiers that define and describe
* biological and other entities, and (b) describing the creator of a
* model and the model's modification history. The annotation content is
* stored in <code><annotation></code> elements attached to
* individual SBML elements. The format for storing the content inside
* SBML <code><annotation></code> elements is a subset of W3C RDF
* (<a target='_blank' href='http://www.w3.org/RDF/'>Resource Description
* Format</a>) expressed in XML. The CVTerm class provides a programming
* interface for working directly with controlled vocabulary term ('CV
* term') objects without having to deal directly with the XML form.
* When libSBML reads in an SBML model containing RDF annotations, it
* parses those annotations into a list of CVTerm objects, and when
* writing a model, it parses the CVTerm objects back into the
* appropriate SBML <code><annotation></code> structure.
*
*
*
* This method creates a CVTerm object from the given XMLNode object @p
* node. XMLNode is libSBML's representation of a node in an XML tree of
* elements, and each such element can be placed in a namespace. This
* constructor looks for the element to be in the XML namespaces
* <code>'http://biomodels.net/model-qualifiers'</code> (for
* model qualifiers) and
* <code>'http://biomodels.net/biology-qualifiers'</code> (for
* biological qualifier), and if they are, creates CVTerm objects for
* the result.
*
* @param node an %XMLNode representing a CVTerm.
*
* @note This method assumes that the given XMLNode object @p node is of
* the correct structural form.
*/
public CVTerm(XMLNode node)
: this(libsbmlPINVOKE.new_CVTerm__SWIG_2(XMLNode.getCPtr(node)), true)
{
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
}