本文整理汇总了C#中libsbml.XMLAttributes类的典型用法代码示例。如果您正苦于以下问题:C# XMLAttributes类的具体用法?C# XMLAttributes怎么用?C# XMLAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLAttributes类属于libsbml命名空间,在下文中一共展示了XMLAttributes类的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_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;
}
示例3: 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;
}
示例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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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) == "" );
}
示例8: 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 );
}
示例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: 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;
}
示例11: test_XMLToken_newSetters_removeAttributes1
public void test_XMLToken_newSetters_removeAttributes1()
{
XMLTriple triple = new XMLTriple("test","","");
XMLAttributes attr = new XMLAttributes();
XMLToken token = new XMLToken(triple,attr);
XMLTriple xt2 = new XMLTriple("name3", "http://name3.org/", "p3");
XMLTriple xt1 = new XMLTriple("name5", "http://name5.org/", "p5");
int i = token.addAttr( "name1", "val1");
i = token.addAttr( "name2", "val2", "http://name1.org/", "p1");
i = token.addAttr(xt2, "val2");
i = token.addAttr( "name4", "val4");
assertTrue( token.getAttributes().getLength() == 4 );
i = token.removeAttr(7);
assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
i = token.removeAttr( "name7");
assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
i = token.removeAttr( "name7", "namespaces7");
assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
i = token.removeAttr(xt1);
assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
assertTrue( token.getAttributes().getLength() == 4 );
i = token.removeAttr(3);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( token.getAttributes().getLength() == 3 );
i = token.removeAttr( "name1");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( token.getAttributes().getLength() == 2 );
i = token.removeAttr( "name2", "http://name1.org/");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( token.getAttributes().getLength() == 1 );
i = token.removeAttr(xt2);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( token.getAttributes().getLength() == 0 );
xt1 = null;
xt2 = null;
triple = null;
attr = null;
token = null;
}
示例12: XMLAttributes
/**
* Copy constructor; creates a copy of this XMLAttributes object.
*
* @p orig the XMLAttributes object to copy.
*/
public XMLAttributes(XMLAttributes orig)
: this(libsbmlPINVOKE.new_XMLAttributes__SWIG_1(XMLAttributes.getCPtr(orig)), true)
{
if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
}
示例13: test_Constraint_copyConstructor
public void test_Constraint_copyConstructor()
{
Constraint o1 = new Constraint(2,4);
o1.setMetaId("c");
assertTrue( o1.getMetaId() == "c" );
XMLNode text = XMLNode.convertStringToXMLNode(" Some text ");
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);
ASTNode math = new ASTNode(libsbml.AST_CONSTANT_PI);
o1.setMath(math);
o1.setMessage(message);
math = null;
message = null;
XMLNode msg;
assertTrue( o1.getMath() != null );
msg = o1.getMessage();
assertTrue( msg != null );
Constraint o2 = new Constraint(o1);
assertTrue( o2.getMetaId() == "c" );
assertTrue( o2.getMath() != null );
msg = o2.getMessage();
assertTrue( msg != null );
assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
o2 = null;
o1 = null;
}
示例14: test_XMLToken_newSetters_removeNamespaces1
public void test_XMLToken_newSetters_removeNamespaces1()
{
XMLTriple triple = new XMLTriple("test","","");
XMLAttributes attr = new XMLAttributes();
XMLToken token = new XMLToken(triple,attr);
token.addNamespace( "http://test1.org/", "test1");
assertTrue( token.getNamespacesLength() == 1 );
int i = token.removeNamespace( "test2");
assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
assertTrue( token.getNamespacesLength() == 1 );
i = token.removeNamespace( "test1");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( token.getNamespacesLength() == 0 );
token = null;
triple = null;
attr = null;
}
示例15: getCPtrAndDisown
internal static HandleRef getCPtrAndDisown(XMLAttributes obj)
{
HandleRef ptr = new HandleRef(null, IntPtr.Zero);
if (obj != null)
{
ptr = obj.swigCPtr;
obj.swigCMemOwn = false;
}
return ptr;
}