Inheritance: IDisposable
コード例 #1
0
ファイル: XMLNode.cs プロジェクト: carolc24/roadrunner
 XMLNode(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces, long line) : this(libsbmlPINVOKE.new_XMLNode__SWIG_3(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes), XMLNamespaces.getCPtr(namespaces), line), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #2
0
ファイル: XMLNode.cs プロジェクト: carolc24/roadrunner
 XMLNode(XMLTriple triple, long line, long column) : this(libsbmlPINVOKE.new_XMLNode__SWIG_8(XMLTriple.getCPtr(triple), line, column), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #3
0
ファイル: XMLNode.cs プロジェクト: carolc24/roadrunner
 XMLNode(XMLTriple triple, XMLAttributes attributes) : this(libsbmlPINVOKE.new_XMLNode__SWIG_7(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #4
0
ファイル: XMLTriple.cs プロジェクト: gitter-badger/sbmlsolver
 XMLTriple(XMLTriple orig) : this(libsbmlPINVOKE.new_XMLTriple__SWIG_4(XMLTriple.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #5
0
ファイル: XMLNode.cs プロジェクト: carolc24/roadrunner
 XMLNode(XMLTriple triple) : this(libsbmlPINVOKE.new_XMLNode__SWIG_10(XMLTriple.getCPtr(triple)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #6
0
 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;
 }
コード例 #7
0
ファイル: XMLTriple.cs プロジェクト: gitter-badger/sbmlsolver
        XMLTriple clone()
        {
            IntPtr    cPtr = libsbmlPINVOKE.XMLTriple_clone(swigCPtr);
            XMLTriple ret  = (cPtr == IntPtr.Zero) ? null : new XMLTriple(cPtr, true);

            return(ret);
        }
コード例 #8
0
 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;
 }
コード例 #9
0
 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;
 }
コード例 #10
0
 void startEndElement(XMLTriple triple)
 {
     libsbmlPINVOKE.XMLOutputStream_startEndElement__SWIG_2(swigCPtr, XMLTriple.getCPtr(triple));
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #11
0
 void writeAttribute(XMLTriple triple, int value)
 {
     libsbmlPINVOKE.XMLOutputStream_writeAttribute__SWIG_14(swigCPtr, XMLTriple.getCPtr(triple), value);
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #12
0
        bool hasAttribute(XMLTriple triple)
        {
            bool ret = libsbmlPINVOKE.XMLAttributes_hasAttribute__SWIG_3(swigCPtr, XMLTriple.getCPtr(triple));

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #13
0
        int add(XMLTriple triple, string value)
        {
            int ret = libsbmlPINVOKE.XMLAttributes_add__SWIG_3(swigCPtr, XMLTriple.getCPtr(triple), value);

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #14
0
        int getIndex(XMLTriple triple)
        {
            int ret = libsbmlPINVOKE.XMLAttributes_getIndex__SWIG_2(swigCPtr, XMLTriple.getCPtr(triple));

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #15
0
ファイル: XMLTriple.cs プロジェクト: gitter-badger/sbmlsolver
        internal static HandleRef getCPtrAndDisown(XMLTriple obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
                ptr             = obj.swigCPtr;
                obj.swigCMemOwn = false;
            }

            return(ptr);
        }
コード例 #16
0
 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;
 }
コード例 #17
0
 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;
 }
コード例 #18
0
 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;
 }
コード例 #19
0
 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 );
 }
コード例 #20
0
 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;
 }
コード例 #21
0
ファイル: TestCVTerms.cs プロジェクト: mgaldzic/copasi_api
 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;
 }
コード例 #22
0
 /**
    * Creates an XML end element.
    *
    * @param triple an XMLTriple object describing the end tag.
    *
    * @param line a long integer, the line number to associate with the
    * token (default = 0).
    *
    * @param column a long integer, the column number to associate with the
    * token (default = 0).
    *
    * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif
    */
 public XMLToken(XMLTriple triple, long line, long column)
     : this(libsbmlPINVOKE.new_XMLToken__SWIG_7(XMLTriple.getCPtr(triple), line, column), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #23
0
 /**
    * Writes the given XML start and end element 'prefix:name' to this
    * XMLOutputStream.
    */
 public void startEndElement(XMLTriple triple)
 {
     libsbmlPINVOKE.XMLOutputStream_startEndElement__SWIG_2(swigCPtr, XMLTriple.getCPtr(triple));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #24
0
 /**
    * Creates an XML end element.
    *
    * @param triple an XMLTriple object describing the end tag.
    *
    * @param line a long integer, the line number to associate with the
    * token (default = 0).
    *
    * @param column a long integer, the column number to associate with the
    * token (default = 0).
    *
    * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif
    */
 public XMLToken(XMLTriple triple)
     : this(libsbmlPINVOKE.new_XMLToken__SWIG_9(XMLTriple.getCPtr(triple)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #25
0
 public void test_XMLNode_removeNamespaces()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLNamespaces nms;
       int i = node.addNamespace( "http://test1.org/", "test1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 1 );
       i = node.addNamespace( "http://test2.org/", "test2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.removeNamespace(7);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.removeNamespace( "name7");
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.removeNamespace(0);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 1 );
       i = node.removeNamespace( "test2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 0 );
       triple = null;
       attr = null;
       node = null;
 }
コード例 #26
0
 public void test_Triple_assignmentOperator()
 {
     XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");
       assertTrue( t.getName() ==  "sarah" );
       assertTrue( t.getURI() ==  "http://foo.org/" );
       assertTrue( t.getPrefix() ==  "bar" );
       XMLTriple t2 = new XMLTriple();
       t2 = t;
       assertTrue( t2.getName() ==  "sarah" );
       assertTrue( t2.getURI() ==  "http://foo.org/" );
       assertTrue( t2.getPrefix() ==  "bar" );
       t = null;
       t2 = null;
 }
コード例 #27
0
ファイル: TestWriteSBML.cs プロジェクト: mgaldzic/copasi_api
 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()) );
 }
コード例 #28
0
 public void test_Token_copyConstructor()
 {
     XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");
       XMLToken token = new XMLToken(t,3,4);
       assertTrue( token.getName() ==  "sarah" );
       assertTrue( token.getURI() ==  "http://foo.org/" );
       assertTrue( token.getPrefix() ==  "bar" );
       assertTrue( token.isEnd() == true );
       assertTrue( token.isEOF() == false );
       assertTrue( token.getLine() == 3 );
       assertTrue( token.getColumn() == 4 );
       XMLToken token2 = new XMLToken(token);
       assertTrue( token2.getName() ==  "sarah" );
       assertTrue( token2.getURI() ==  "http://foo.org/" );
       assertTrue( token2.getPrefix() ==  "bar" );
       assertTrue( token2.isEnd() == true );
       assertTrue( token2.isEOF() == false );
       assertTrue( token2.getLine() == 3 );
       assertTrue( token2.getColumn() == 4 );
       t = null;
       token = null;
       token2 = null;
 }
コード例 #29
0
 /**
    * Returns @c true if an attribute with the given properties exists.
    *
    * @param triple an XMLTriple describing the attribute to be tested.
    *
    * @return @c true if an attribute with the given XML triple exists in this
    * XMLAttributes object, @c false otherwise.
    *
    * @see add(string name, string value, string namespaceURI, string prefix)
    * @see add(XMLTriple triple, string value)
    */
 public bool hasAttribute(XMLTriple triple)
 {
     bool ret = libsbmlPINVOKE.XMLAttributes_hasAttribute__SWIG_3(swigCPtr, XMLTriple.getCPtr(triple));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
コード例 #30
0
 /**
    * Return the value of an attribute described by a given XMLTriple object.
    *
    * @param triple an XMLTriple describing the attribute whose value is being
    * sought.
    *
    * @return The attribute value as a string.
    *
    * @note If an attribute with the properties given by @p triple does not
    * exist in this XMLAttributes object, this method will return an empty
    * string.  Callers can use
    * XMLAttributes::hasAttribute(string name, string uri)
    * to test for an attribute's existence.
    *
    * @see hasAttribute(string name, string uri)
    * @see hasAttribute(XMLTriple triple)
    */
 public string getValue(XMLTriple triple)
 {
     string ret = libsbmlPINVOKE.XMLAttributes_getValue__SWIG_3(swigCPtr, XMLTriple.getCPtr(triple));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
コード例 #31
0
ファイル: TestSBase.cs プロジェクト: mgaldzic/copasi_api
 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;
 }
コード例 #32
0
ファイル: TestSBase.cs プロジェクト: mgaldzic/copasi_api
 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;
 }
コード例 #33
0
        /**
           * Adds an attribute to this list of attributes.
           *
           *
         *
         * Some explanations are in order about the behavior of XMLAttributes with
         * respect to namespace prefixes and namespace URIs.  XMLAttributes does @em
         * not verify the consistency of different uses of an XML namespace and the
         * prefix used to refer to it in a given context.  It cannot, because the
         * prefix used for a given XML namespace in an XML document may intentionally
         * be different on different elements in the document.  Consequently, callers
         * need to manage their own prefix-to-namespace mappings, and need to ensure
         * that the desired prefix is used in any given context.
         *
         * When called with attribute names, prefixes and namespace URIs,
         * XMLAttributes pays attention to the namespace URIs and not the prefixes: a
         * match is established by a combination of attribute name and namespace URI,
         * and if on different occasions a different prefix is used for the same
         * name/namespace combination, the prefix associated with the namespace on
         * that attribute is overwritten.
         *
         * Some examples will hopefully clarify this.  Here are the results of a
         * sequence of calls to the XMLAttributes <code>add</code> methods with
         * different argument combinations.  First, we create the object and add
         * one attribute:
         *
         * @code{.cpp}
        XMLAttributes  att = new XMLAttributes();
        att->add('myattribute', '1', 'myuri');
        @endcode
         * The above adds an attribute named <code>myattribute</code> in the namespace
         * <code>myuri</code>, and with the attribute value <code>1</code>.  No
         * namespace prefix is associated with the attribute (but the attribute is
         * recorded to exist in the namespace <code>myuri</code>).  If
         * this attribute object were written out in XML, it would look like the
         * following (and note that, since no namespace prefix was assigned, none
         * is written out):
         * <center><pre>
        myattribute='1'
         * </pre></center>
         *
         * Continuing with this series of examples, suppose we invoke the
         * <code>add</code> method again as follows:
         *
         * @code{.cpp}
        att->add('myattribute', '2');
        @endcode
         * The above adds a @em new attribute @em also named <code>myattribute</code>,
         * but in a different XML namespace: it is placed in the namespace with no
         * URI, which is to say, the default XML namespace.  Both attributes coexist
         * on this XMLAttributes object; both can be independently retrieved.
         *
         * @code{.cpp}
        att->add('myattribute', '3');
        @endcode
         * The code above now replaces the value of the attribute
         * <code>myattribute</code> that resides in the default namespace.  The
         * attribute in the namespace <code>myuri</code> remains untouched.
         *
         * @code{.cpp}
        att->add('myattribute', '4', 'myuri');
        @endcode
         * The code above replaces the value of the attribute
         * <code>myattribute</code> that resides in the <code>myuri</code> namespace.
         * The attribute in the default namespace remains untouched.
         *
         * @code{.cpp}
        att->add('myattribute', '5', 'myuri', 'foo');
        @endcode
         * The code above replaces the value of the attribute
         * <code>myattribute</code> that resides in the <code>myuri</code> namespace.
         * It also now assigns a namespace prefix, <code>foo</code>, to the attribute.
         * The attribute <code>myattribute</code> in the default namespace remains
         * untouched. If this XMLAttributes object were written out in XML, it would
         * look like the following:
         * <center><pre>
        myattribute='3'
        foo:myattribute='5'
         * </pre></center>
         * Pressing on, now suppose we call the <code>add</code> method as follows:
         *
         * @code{.cpp}
        att->add('myattribute', '6', 'myuri', 'bar');
        @endcode
         * The code above replaces the value of the attribute
         * <code>myattribute</code> that resides in the <code>myuri</code> namespace.
         * It also assigns a different prefix to the attribute.  The namespace of
         * the attribute remains <code>myuri</code>.
         *
         * @code{.cpp}
        att->add('myattribute', '7', '', 'foo');
        @endcode

         * The code above replaces the value of the attribute
         * <code>myattribute</code> that resides in the default namespace.  It also
         * now assigns a namespace prefix, <code>foo</code>, to that attribute.  If
         * this XMLAttributes object were written out in XML, it would look like the
         * following:
         * <center><pre>
        bar:myattribute='6'
        foo:myattribute='7'
         * </pre></center>
           *
           * @param triple an XMLTriple object describing the attribute to be added.
           * @param value a string, the value of the attribute.
           *
           *
         * @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 LIBSBML_OPERATION_SUCCESS@endlink
           * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
           * &ndash; this value is returned if any of the arguments are @c null.  To
           * set an empty value for the attribute, use an empty string rather than @c
           * null.
           *
           *
         * @note If an attribute with the same name and XML namespace URI already
         * exists in the list of attributes held by this XMLAttributes object, then
         * the previous value of that attribute will be replaced with the new value
         * provided to this method.
         *
         *
           *
           * @see add(string name, string value, string namespaceURI, string prefix)
           * @see getIndex(string name, string uri)
           * @see getIndex(XMLTriple triple)
           * @see hasAttribute(string name, string uri)
           * @see hasAttribute(XMLTriple triple)
           */
        public int add(XMLTriple triple, string value)
        {
            int ret = libsbmlPINVOKE.XMLAttributes_add__SWIG_3(swigCPtr, XMLTriple.getCPtr(triple), value);
            if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            return ret;
        }
コード例 #34
0
ファイル: XMLTriple.cs プロジェクト: gitter-badger/sbmlsolver
 internal static HandleRef getCPtr(XMLTriple obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #35
0
 /**
    * Copy constructor; creates a copy of this XMLTriple object.
    *
    * @param orig the XMLTriple object to copy.
    */
 public XMLTriple(XMLTriple orig)
     : this(libsbmlPINVOKE.new_XMLTriple__SWIG_4(XMLTriple.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #36
0
 public void test_Triple_copyConstructor()
 {
     XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");
       assertTrue( t.getName() ==  "sarah" );
       assertTrue( t.getURI() ==  "http://foo.org/" );
       assertTrue( t.getPrefix() ==  "bar" );
       XMLTriple t2 = new XMLTriple(t);
       assertTrue( t2.getName() ==  "sarah" );
       assertTrue( t2.getURI() ==  "http://foo.org/" );
       assertTrue( t2.getPrefix() ==  "bar" );
       t = null;
       t2 = null;
 }
コード例 #37
0
 internal static HandleRef getCPtr(XMLTriple obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
コード例 #38
0
 public void test_Triple_clone()
 {
     XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");
       assertTrue( t.getName() ==  "sarah" );
       assertTrue( t.getURI() ==  "http://foo.org/" );
       assertTrue( t.getPrefix() ==  "bar" );
       XMLTriple t2 = (XMLTriple) t.clone();
       assertTrue( t2.getName() ==  "sarah" );
       assertTrue( t2.getURI() ==  "http://foo.org/" );
       assertTrue( t2.getPrefix() ==  "bar" );
       t = null;
       t2 = null;
 }
コード例 #39
0
        internal static HandleRef getCPtrAndDisown(XMLTriple obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
            ptr             = obj.swigCPtr;
            obj.swigCMemOwn = false;
            }

            return ptr;
        }
コード例 #40
0
 /**
    * Returns the index of the attribute defined by the given XMLTriple object.
    *
    * @param triple an XMLTriple describing the attribute being sought.
    *
    * @return the index of an attribute described by the given XMLTriple
    * object, or <code>-1</code> if no such attribute is present.
    *
    * @see hasAttribute(string name, string uri)
    * @see hasAttribute(XMLTriple triple)
    */
 public int getIndex(XMLTriple triple)
 {
     int ret = libsbmlPINVOKE.XMLAttributes_getIndex__SWIG_2(swigCPtr, XMLTriple.getCPtr(triple));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
コード例 #41
0
 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;
 }
コード例 #42
0
 /**
    * Writes the given attribute, prefix:name='value' to this
    * XMLOutputStream.
    */
 public void writeAttribute(XMLTriple triple, int value)
 {
     libsbmlPINVOKE.XMLOutputStream_writeAttribute__SWIG_14(swigCPtr, XMLTriple.getCPtr(triple), value);
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #43
0
 public void test_XMLAttributes_add_remove_qname_C()
 {
     XMLAttributes xa = new  XMLAttributes();
       XMLTriple xt1 = new  XMLTriple("name1", "http://name1.org/", "p1");
       XMLTriple xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
       XMLTriple xt3 = new  XMLTriple("name3", "http://name3.org/", "p3");
       XMLTriple xt1a = new  XMLTriple("name1", "http://name1a.org/", "p1a");
       XMLTriple xt2a = new  XMLTriple("name2", "http://name2a.org/", "p2a");
       xa.add( "name1", "val1", "http://name1.org/", "p1");
       xa.add(xt2, "val2");
       assertTrue( xa.getLength() == 2 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "name1" != xa.getName(0) ) == false );
       assertTrue( (  "val1"  != xa.getValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != xa.getURI(0) ) == false );
       assertTrue( (  "p1"    != xa.getPrefix(0) ) == false );
       assertTrue( (  "name2" != xa.getName(1) ) == false );
       assertTrue( (  "val2"  != xa.getValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != xa.getURI(1) ) == false );
       assertTrue( (  "p2"    != xa.getPrefix(1) ) == false );
       assertTrue( (  "val1"  != xa.getValue( "name1") ) == false );
       assertTrue( (  "val2"  != xa.getValue( "name2") ) == false );
       assertTrue( (  "val1"  != xa.getValue( "name1", "http://name1.org/") ) == false );
       assertTrue( (  "val2"  != xa.getValue( "name2", "http://name2.org/") ) == false );
       assertTrue( (  "val1"  != xa.getValue(xt1) ) == false );
       assertTrue( (  "val2"  != xa.getValue(xt2) ) == false );
       assertTrue( xa.hasAttribute(-1) == false );
       assertTrue( xa.hasAttribute(2) == false );
       assertTrue( xa.hasAttribute(0) == true );
       assertTrue( xa.hasAttribute( "name1", "http://name1.org/") == true );
       assertTrue( xa.hasAttribute( "name2", "http://name2.org/") == true );
       assertTrue( xa.hasAttribute( "name3", "http://name3.org/") == false );
       assertTrue( xa.hasAttribute(xt1) == true );
       assertTrue( xa.hasAttribute(xt2) == true );
       assertTrue( xa.hasAttribute(xt3) == false );
       xa.add( "noprefix", "val3");
       assertTrue( xa.getLength() == 3 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "noprefix" != xa.getName(2) ) == false );
       assertTrue( (  "val3"     != xa.getValue(2) ) == false );
       assertTrue( xa.getURI(2) == "" );
       assertTrue( xa.getPrefix(2) == "" );
       assertTrue( (  "val3"  != xa.getValue( "noprefix", "") ) == false );
       assertTrue( xa.hasAttribute( "noprefix"    ) == true );
       assertTrue( xa.hasAttribute( "noprefix", "") == true );
       xa.add(xt1, "mval1");
       xa.add( "name2", "mval2", "http://name2.org/", "p2");
       xa.add( "noprefix", "mval3");
       assertTrue( xa.getLength() == 3 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "name1" != xa.getName(0) ) == false );
       assertTrue( (  "mval1" != xa.getValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != xa.getURI(0) ) == false );
       assertTrue( (  "p1"    != xa.getPrefix(0) ) == false );
       assertTrue( (  "name2"    != xa.getName(1) ) == false );
       assertTrue( (  "mval2"    != xa.getValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != xa.getURI(1) ) == false );
       assertTrue( (  "p2"       != xa.getPrefix(1) ) == false );
       assertTrue( (  "noprefix" != xa.getName(2) ) == false );
       assertTrue( (  "mval3"    != xa.getValue(2) ) == false );
       assertTrue( xa.getURI(2) == "" );
       assertTrue( xa.getPrefix(2) == "" );
       assertTrue( xa.hasAttribute(xt1) == true );
       assertTrue( xa.hasAttribute( "name1", "http://name1.org/") == true );
       assertTrue( xa.hasAttribute( "noprefix") == true );
       xa.add(xt1a, "val1a");
       xa.add(xt2a, "val2a");
       assertTrue( xa.getLength() == 5 );
       assertTrue( (  "name1" != xa.getName(3) ) == false );
       assertTrue( (  "val1a" != xa.getValue(3) ) == false );
       assertTrue( (  "http://name1a.org/" != xa.getURI(3) ) == false );
       assertTrue( (  "p1a" != xa.getPrefix(3) ) == false );
       assertTrue( (  "name2" != xa.getName(4) ) == false );
       assertTrue( (  "val2a" != xa.getValue(4) ) == false );
       assertTrue( (  "http://name2a.org/" != xa.getURI(4) ) == false );
       assertTrue( (  "p2a" != xa.getPrefix(4) ) == false );
       assertTrue( (  "mval1"  != xa.getValue( "name1") ) == false );
       assertTrue( (  "mval2"  != xa.getValue( "name2") ) == false );
       assertTrue( (  "val1a"  != xa.getValue( "name1", "http://name1a.org/") ) == false );
       assertTrue( (  "val2a"  != xa.getValue( "name2", "http://name2a.org/") ) == false );
       assertTrue( (  "val1a"  != xa.getValue(xt1a) ) == false );
       assertTrue( (  "val2a"  != xa.getValue(xt2a) ) == false );
       xa.remove(xt1a);
       xa.remove(xt2a);
       assertTrue( xa.getLength() == 3 );
       xa.remove( "name1", "http://name1.org/");
       assertTrue( xa.getLength() == 2 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "name2" != xa.getName(0) ) == false );
       assertTrue( (  "mval2" != xa.getValue(0) ) == false );
       assertTrue( (  "http://name2.org/" != xa.getURI(0) ) == false );
       assertTrue( (  "p2" != xa.getPrefix(0) ) == false );
       assertTrue( (  "noprefix" != xa.getName(1) ) == false );
       assertTrue( (  "mval3" != xa.getValue(1) ) == false );
       assertTrue( xa.getURI(1) == "" );
       assertTrue( xa.getPrefix(1) == "" );
       assertTrue( xa.hasAttribute( "name1", "http://name1.org/") == false );
       xa.remove(xt2);
       assertTrue( xa.getLength() == 1 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "noprefix" != xa.getName(0) ) == false );
       assertTrue( (  "mval3" != xa.getValue(0) ) == false );
       assertTrue( xa.getURI(0) == "" );
       assertTrue( xa.getPrefix(0) == "" );
       assertTrue( xa.hasAttribute(xt2) == false );
       assertTrue( xa.hasAttribute( "name2", "http://name2.org/") == false );
       xa.remove( "noprefix", "");
       assertTrue( xa.getLength() == 0 );
       assertTrue( xa.isEmpty() == true );
       assertTrue( xa.hasAttribute( "noprefix"    ) == false );
       assertTrue( xa.hasAttribute( "noprefix", "") == false );
       xa = null;
       xt1 = null;
       xt2 = null;
       xt3 = null;
       xt1a = null;
       xt2a = null;
 }