本文整理汇总了C#中libsbmlcs.XMLToken类的典型用法代码示例。如果您正苦于以下问题:C# XMLToken类的具体用法?C# XMLToken怎么用?C# XMLToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLToken类属于libsbmlcs命名空间,在下文中一共展示了XMLToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test_XMLToken_newSetters_addAttributes1
public void test_XMLToken_newSetters_addAttributes1()
{
XMLTriple triple = new XMLTriple("test","","");
XMLAttributes attr = new XMLAttributes();
XMLToken token = new XMLToken(triple,attr);
XMLTriple xt2 = new XMLTriple("name3", "http://name3.org/", "p3");
int i = token.addAttr( "name1", "val1");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( token.getAttributesLength() == 1 );
assertTrue( token.isAttributesEmpty() == false );
assertTrue( ( "name1" != token.getAttrName(0) ) == false );
assertTrue( ( "val1" != token.getAttrValue(0) ) == false );
i = token.addAttr( "name2", "val2", "http://name1.org/", "p1");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( token.getAttributesLength() == 2 );
assertTrue( token.isAttributesEmpty() == false );
assertTrue( ( "name2" != token.getAttrName(1) ) == false );
assertTrue( ( "val2" != token.getAttrValue(1) ) == false );
assertTrue( ( "http://name1.org/" != token.getAttrURI(1) ) == false );
assertTrue( ( "p1" != token.getAttrPrefix(1) ) == false );
i = token.addAttr(xt2, "val2");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( token.getAttributesLength() == 3 );
assertTrue( token.isAttributesEmpty() == false );
assertTrue( ( "name3" != token.getAttrName(2) ) == false );
assertTrue( ( "val2" != token.getAttrValue(2) ) == false );
assertTrue( ( "http://name3.org/" != token.getAttrURI(2) ) == false );
assertTrue( ( "p3" != token.getAttrPrefix(2) ) == false );
xt2 = null;
triple = null;
attr = null;
token = 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_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 );
}
示例4: test_XMLToken_newSetters_addAttributes2
public void test_XMLToken_newSetters_addAttributes2()
{
XMLTriple triple = new XMLTriple("test","","");
XMLToken token = new XMLToken(triple);
XMLTriple xt2 = new XMLTriple("name3", "http://name3.org/", "p3");
int i = token.addAttr( "name1", "val1");
assertTrue( i == libsbml.LIBSBML_INVALID_XML_OPERATION );
assertTrue( token.getAttributesLength() == 0 );
assertTrue( token.isAttributesEmpty() == true );
i = token.addAttr( "name2", "val2", "http://name1.org/", "p1");
assertTrue( i == libsbml.LIBSBML_INVALID_XML_OPERATION );
assertTrue( token.getAttributesLength() == 0 );
assertTrue( token.isAttributesEmpty() == true );
i = token.addAttr(xt2, "val2");
assertTrue( i == libsbml.LIBSBML_INVALID_XML_OPERATION );
assertTrue( token.getAttributesLength() == 0 );
assertTrue( token.isAttributesEmpty() == true );
xt2 = null;
triple = null;
token = null;
}
示例5: 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;
}
示例6: readAttributes
/** */
/* libsbml-internal */
public new bool readAttributes(XMLAttributes attributes, SWIGTYPE_p_ExpectedAttributes expectedAttributes, XMLInputStream stream, XMLToken element)
{
bool ret = libsbmlPINVOKE.ASTBase_readAttributes(swigCPtr, XMLAttributes.getCPtr(attributes), SWIGTYPE_p_ExpectedAttributes.getCPtr(expectedAttributes), XMLInputStream.getCPtr(stream), XMLToken.getCPtr(element));
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
示例7: logError
/** */
/* libsbml-internal */
public new void logError(XMLInputStream stream, XMLToken element, int code)
{
libsbmlPINVOKE.ASTBase_logError__SWIG_1(swigCPtr, XMLInputStream.getCPtr(stream), XMLToken.getCPtr(element), code);
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
}
示例8: 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() ));
}
示例9: XMLNode
/**
* Creates a new XMLNode by copying token.
*
* @param token XMLToken to be copied to XMLNode
*/
public XMLNode(XMLToken token)
: this(libsbmlPINVOKE.new_XMLNode__SWIG_1(XMLToken.getCPtr(token)), true)
{
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
}
示例10: skipPastEnd
/**
* Consume zero or more tokens up to and including the corresponding end
* element or EOF.
*
* @param element the element whose end will be sought in the input stream.
*/
public void skipPastEnd(XMLToken element)
{
libsbmlPINVOKE.XMLInputStream_skipPastEnd(swigCPtr, XMLToken.getCPtr(element));
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
}
示例11: next
/**
* Returns the next token on this XML input stream.
*
* The token is consumed in the process.
*
* @return the next XMLToken, or an EOF token (i.e.,
* <code>XMLToken.isEOF() == true</code>).
*
* @see peek()
*/
public XMLToken next()
{
XMLToken ret = new XMLToken(libsbmlPINVOKE.XMLInputStream_next(swigCPtr), true);
return ret;
}
示例12: getCPtrAndDisown
internal static HandleRef getCPtrAndDisown(XMLToken obj)
{
HandleRef ptr = new HandleRef(null, IntPtr.Zero);
if (obj != null)
{
ptr = obj.swigCPtr;
obj.swigCMemOwn = false;
}
return ptr;
}
示例13: test_XMLToken_newSetters_setTriple1
public void test_XMLToken_newSetters_setTriple1()
{
XMLTriple triple = new XMLTriple("test","","");
XMLToken token = new XMLToken();
int i = token.setTriple(triple);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(( "test" == token.getName() ));
triple = null;
token = null;
}
示例14: test_XMLToken_newSetters_setNamespaces2
public void test_XMLToken_newSetters_setNamespaces2()
{
int i;
XMLTriple triple = new XMLTriple("test","","");
XMLToken token = new XMLToken(triple);
XMLNamespaces ns = new XMLNamespaces();
assertTrue( token.getNamespacesLength() == 0 );
assertTrue( token.isNamespacesEmpty() == true );
ns.add( "http://test1.org/", "test1");
i = token.setNamespaces(ns);
assertTrue( i == libsbml.LIBSBML_INVALID_XML_OPERATION );
assertTrue( token.getNamespacesLength() == 0 );
assertTrue( token.isNamespacesEmpty() == true );
triple = null;
token = null;
ns = null;
}
示例15: test_XMLToken_newSetters_setEOF
public void test_XMLToken_newSetters_setEOF()
{
XMLToken token = new XMLToken();
assertTrue( token.isEnd() == false );
int i = token.setEOF();
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( token.isEnd() == false );
assertTrue( token.isStart() == false );
assertTrue( token.isText() == false );
token = null;
}