Inheritance: XMLToken
 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;
 }
 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;
 }
 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;
 }
 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;
 }
        internal static HandleRef getCPtrAndDisown(XMLNode obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return(ptr);
        }
 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;
 }
 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;
 }
 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;
 }
 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 );
 }
 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;
 }
        int appendAnnotation(XMLNode annotation)
        {
            int ret = libsbmlPINVOKE.SpeciesReference_appendAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));

            return(ret);
        }
Exemple #12
0
        static string convertXMLNodeToString(XMLNode node)
        {
            string ret = libsbmlPINVOKE.XMLNode_convertXMLNodeToString(XMLNode.getCPtr(node));

            return(ret);
        }
Exemple #13
0
 /**
    * 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.  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
    * @li @link libsbmlcs.libsbml.LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT @endlink
    *
    * @see removeTopLevelAnnotationElement(string elementName, string elementURI)
    * @see replaceTopLevelAnnotationElement(string)
    */
 public int replaceTopLevelAnnotationElement(XMLNode annotation)
 {
     int ret = libsbmlPINVOKE.SBase_replaceTopLevelAnnotationElement__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
     return ret;
 }
Exemple #14
0
 /**
    * 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&nbsp;1.0</a>.  To help
    * verify the formatting of 'notes' content, libSBML provides the static
    * utility method SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode xhtml@endif); 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&nbsp;2 and &nbsp;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.  The possible values returned by this function are:
    * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED @endlink
    *
    * @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 XMLNode xhtml@endif)
    */
 public int appendNotes(XMLNode notes)
 {
     int ret = libsbmlPINVOKE.SBase_appendNotes__SWIG_0(swigCPtr, XMLNode.getCPtr(notes));
     return ret;
 }
Exemple #15
0
        static ModelHistory parseRDFAnnotation(XMLNode annotation, string metaId)
        {
            global::System.IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_1(XMLNode.getCPtr(annotation), metaId);
            ModelHistory          ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ModelHistory(cPtr, false);

            return(ret);
        }
Exemple #16
0
 internal static HandleRef getCPtr(XMLNode obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 /**
    * Appends annotation content to any existing content in the 'annotation'
    * subelement of this object.
    *
    * The content in @p annotation is copied.  Unlike
    * SpeciesReference::setAnnotation(@if java String annotation@endif),
    * 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 setAnnotation(string annotation)
    * @see setAnnotation(XMLNode annotation)
    */
 public new int appendAnnotation(XMLNode annotation)
 {
     int ret = libsbmlPINVOKE.SpeciesReference_appendAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
     return ret;
 }
        static ModelHistory parseRDFAnnotation(XMLNode annotation)
        {
            IntPtr       cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_2(XMLNode.getCPtr(annotation));
            ModelHistory ret  = (cPtr == IntPtr.Zero) ? null : new ModelHistory(cPtr, false);

            return(ret);
        }
 public static void parseRDFAnnotation(XMLNode annotation, CVTermList CVTerms, string metaId)
 {
     libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_5(XMLNode.getCPtr(annotation), CVTermList.getCPtr(CVTerms), metaId);
 }
 /**
    * Creates a new ModelCreator from an XMLNode.
    *
    * @param creator the XMLNode from which to create the ModelCreator.
    */
 public ModelCreator(XMLNode creator)
     : this(libsbmlPINVOKE.new_ModelCreator__SWIG_1(XMLNode.getCPtr(creator)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void parseRDFAnnotation(XMLNode annotation, CVTermList CVTerms, string metaId, XMLInputStream stream)
 {
     libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_4(XMLNode.getCPtr(annotation), CVTermList.getCPtr(CVTerms), metaId, XMLInputStream.getCPtr(stream));
 }
 public static void parseRDFAnnotation(XMLNode annotation, CVTermList CVTerms)
 {
     libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_3(XMLNode.getCPtr(annotation), CVTermList.getCPtr(CVTerms));
 }
        static XMLNode deleteRDFCVTermAnnotation(XMLNode annotation)
        {
            IntPtr  cPtr = libsbmlPINVOKE.RDFAnnotationParser_deleteRDFCVTermAnnotation(XMLNode.getCPtr(annotation));
            XMLNode ret  = (cPtr == IntPtr.Zero) ? null : new XMLNode(cPtr, false);

            return(ret);
        }
Exemple #24
0
        static XMLNode deleteRDFHistoryAnnotation(XMLNode annotation)
        {
            global::System.IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_deleteRDFHistoryAnnotation(XMLNode.getCPtr(annotation));
            XMLNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new XMLNode(cPtr, false);

            return(ret);
        }
        static bool hasExpectedXHTMLSyntax(XMLNode xhtml)
        {
            bool ret = libsbmlPINVOKE.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_1(XMLNode.getCPtr(xhtml));

            return(ret);
        }
 /**
    * Sets the message of this Constraint.
    *
    * The XMLNode tree passed in @p xhtml is copied.
    *
    * @param xhtml an XML tree containing XHTML content.
    *
    *
  * @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
    */
 public int setMessage(XMLNode xhtml)
 {
     int ret = libsbmlPINVOKE.Constraint_setMessage__SWIG_0(swigCPtr, XMLNode.getCPtr(xhtml));
     return ret;
 }
        static ModelHistory parseRDFAnnotation(XMLNode annotation, string metaId, XMLInputStream stream)
        {
            IntPtr       cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_0(XMLNode.getCPtr(annotation), metaId, XMLInputStream.getCPtr(stream));
            ModelHistory ret  = (cPtr == IntPtr.Zero) ? null : new ModelHistory(cPtr, false);

            return(ret);
        }
Exemple #28
0
 /**
    * Creates a new CVTerm from the given XMLNode.
    *
    *
  *
  * The SBML Level&nbsp;2 and Level&nbsp;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>&lt;annotation&gt;</code> elements attached to
  * individual SBML elements.  The format for storing the content inside
  * SBML <code>&lt;annotation&gt;</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>&lt;annotation&gt;</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();
 }
Exemple #29
0
 /**
    * 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;
 }
        static bool hasExpectedXHTMLSyntax(XMLNode xhtml, SBMLNamespaces sbmlns)
        {
            bool ret = libsbmlPINVOKE.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_0(XMLNode.getCPtr(xhtml), SBMLNamespaces.getCPtr(sbmlns));

            return(ret);
        }
Exemple #31
0
 /**
    * 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;
 }
Exemple #32
0
 /**
    * 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 LIBSBML_OPERATION_SUCCESS@endlink
    *
    * @see appendAnnotation(XMLNode annotation)
    */
 public new int setAnnotation(XMLNode annotation)
 {
     int ret = libsbmlPINVOKE.Model_setAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
     return ret;
 }
Exemple #33
0
 /**
    * Returns the first child of this XMLNode with the corresponding name.
    *
    * If no child with corrsponding name can be found,
    * this method returns an empty node.
    *
    * @param name the name of the node to return
    *
    * @return the first child of this XMLNode with given name.
    */
 public XMLNode getChild(string name)
 {
     XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_getChild__SWIG_2(swigCPtr, name), false);
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemple #34
0
 /**
    * 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();
 }
 public void test_SBase_appendAnnotationString()
 {
     XMLToken token;
       XMLNode node;
       token = new  XMLToken("This is a test note");
       node = new XMLNode(token);
       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");
       token_top = new XMLToken(triple, att, ns);
       node_top = new XMLNode(token_top);
       node_top.addChild(node);
       int i = S.setAnnotation(node_top);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = S.appendAnnotation("<prA:other xmlns:prA=\"http://some\">This is additional</prA:other>");
       XMLNode t1 = S.getAnnotation();
       assertTrue( t1.getNumChildren() == 2 );
       assertTrue((     "This is a test note" == t1.getChild(0).getChild(0).getCharacters() ));
       XMLNode c1 = t1.getChild(1);
       assertTrue( c1.getNumChildren() == 1 );
       assertTrue((  "This is additional" == c1.getChild(0).getCharacters() ));
 }
Exemple #36
0
 /**
    * 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 LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbmlcs#LIBSBML_INVALID_XML_OPERATION LIBSBML_INVALID_XML_OPERATION@endlink
    *
    * @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;
 }
 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);
       int i = S.setNotes(node);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( S.isSetNotes() == true );
       token1 = new  XMLToken(triple,att,ns);
       node1 = new XMLNode(token1);
       node1.addChild(node5);
       i = S.appendNotes(node1);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       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;
 }
Exemple #38
0
 /**
    * Returns the <code>n</code>th child of this XMLNode.
    *
    * If the index @p n is greater than the number of child nodes,
    * this method returns an empty node.
    *
    * @param n a long integereger, the index of the node to return
    *
    * @return the <code>n</code>th child of this XMLNode.
    */
 public XMLNode getChild(long n)
 {
     XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_getChild__SWIG_0(swigCPtr, n), false);
     return ret;
 }
 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);
       int i = S.setNotes(body_node);
       i = S.appendNotes(p_node1);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       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;
 }
Exemple #40
0
 /**
    * Inserts a copy of the given node as the <code>n</code>th child of this
    * XMLNode.
    *
    * If the given index @p n is out of range for this XMLNode instance,
    * the @p node is added at the end of the list of children.  Even in
    * that situation, this method does not throw an error.
    *
    * @param n an integer, the index at which the given node is inserted
    * @param node an XMLNode to be inserted as <code>n</code>th child.
    *
    * @return a reference to the newly-inserted child @p node
    */
 public XMLNode insertChild(long n, XMLNode node)
 {
     XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_insertChild(swigCPtr, n, XMLNode.getCPtr(node)), false);
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 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() ));
 }
Exemple #42
0
        internal static HandleRef getCPtrAndDisown(XMLNode obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return ptr;
        }
Exemple #43
0
 internal static HandleRef getCPtr(XMLNode obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Exemple #44
0
 /**
    * 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;
 }
Exemple #45
0
        XMLNode insertChild(long n, XMLNode node)
        {
            XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_insertChild(swigCPtr, n, XMLNode.getCPtr(node)), false);

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #46
0
        int setMessage(XMLNode xhtml)
        {
            int ret = libsbmlPINVOKE.Constraint_setMessage__SWIG_0(swigCPtr, XMLNode.getCPtr(xhtml));

            return(ret);
        }
Exemple #47
0
        XMLNode getChild(long n)
        {
            XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_getChild__SWIG_0(swigCPtr, n), false);

            return(ret);
        }