1 //------------------------------------------------------------------------------ 2 // <auto-generated /> 3 // 4 // This file was automatically generated by SWIG (http://www.swig.org). 5 // Version 4.0.2 6 // 7 // Do not make changes to this file unless you know what you are doing--modify 8 // the SWIG interface file instead. 9 //------------------------------------------------------------------------------ 10 11 namespace libsbml { 12 13 using System; 14 using System.Runtime.InteropServices; 15 16 /** 17 * @sbmlpackage{core} 18 * 19 @htmlinclude pkg-marker-core.html A node in libSBML's XML document tree. 20 * 21 * LibSBML implements an XML abstraction layer. This layer presents a 22 * uniform XML interface to calling programs regardless of which underlying 23 * XML parser libSBML has actually been configured to use. The basic data 24 * object in the XML abstraction is a @em node, represented by XMLNode. 25 * 26 * An XMLNode can contain any number of children. Each child is another 27 * XMLNode, thereby forming a tree. The methods XMLNode::getNumChildren() 28 * and XMLNode::getChild(@if java long@endif) can be used to access the tree 29 * structure starting from a given node. 30 * 31 * Each XMLNode is subclassed from XMLToken, and thus has the same methods 32 * available as XMLToken. These methods include XMLToken::getNamespaces(), 33 * XMLToken::getPrefix(), XMLToken::getName(), XMLToken::getURI(), and 34 * XMLToken::getAttributes(). 35 * 36 * @section xmlnode-str2xmlnode Conversion between an XML string and an XMLNode 37 * 38 * LibSBML provides the following utility functions for converting an XML 39 * string (e.g., <code><annotation>...</annotation></code>) 40 * to/from an XMLNode object. 41 * 42 * @li XMLNode::toXMLString() returns a string representation of the XMLNode 43 * object. 44 * 45 * @li XMLNode::convertXMLNodeToString(@if java XMLNode@endif) (static 46 * function) returns a string representation of the given XMLNode object. 47 * 48 * @li XMLNode::convertStringToXMLNode(@if java String@endif) (static 49 * function) returns an XMLNode object converted from the given XML string. 50 * 51 * The returned XMLNode object by XMLNode::convertStringToXMLNode(@if java 52 * String@endif) is a dummy root (container) XMLNode if the given XML string 53 * has two or more top-level elements (e.g., 54 * "<code><p>...</p><p>...</p></code>"). In 55 * the dummy root node, each top-level element in the given XML string is 56 * contained as a child XMLNode. XMLToken::isEOF() can be used to identify 57 * if the returned XMLNode object is a dummy node or not. Here is an 58 * example: 59 @if cpp 60 @code{.cpp} 61 // Checks if the XMLNode object returned by XMLNode::convertStringToXMLNode() 62 // is a dummy root node: 63 64 string str = '...'; 65 XMLNode xn = XMLNode::convertStringToXMLNode(str); 66 if ( xn == null ) 67 { 68 // returned value is null (error) 69 ... 70 } 71 else if ( xn->isEOF() ) 72 { 73 // Root node is a dummy node. 74 for ( int i = 0; i < xn->getNumChildren(); i++ ) 75 { 76 // access to each child node of the dummy node. 77 XMLNode xnChild = xn->getChild(i); 78 ... 79 } 80 } 81 else 82 { 83 // Root node is NOT a dummy node. 84 ... 85 } 86 @endcode 87 @endif 88 @if java 89 @code{.java} 90 // Checks if the returned XMLNode object is a dummy root node: 91 92 String str = '...'; 93 XMLNode xn = XMLNode.convertStringToXMLNode(str); 94 if ( xn == null ) 95 { 96 // returned value is null (error) 97 ... 98 } 99 else if ( xn.isEOF() ) 100 { 101 // Root node is a dummy node. 102 for ( int i = 0; i < xn.getNumChildren(); i++ ) 103 { 104 // access to each child node of the dummy node. 105 XMLNode xnChild = xn.getChild(i); 106 ... 107 } 108 } 109 else 110 { 111 // Root node is NOT a dummy node. 112 ... 113 } 114 @endcode 115 @endif 116 @if python 117 @code{.py} 118 xn = XMLNode.convertStringToXMLNode('<p></p>') 119 if xn == None: 120 # Do something to handle exceptional situation. 121 122 elif xn.isEOF(): 123 # Node is a dummy node. 124 125 else: 126 # None is not a dummy node. 127 @endcode 128 @endif 129 * 130 */ 131 132 public class XMLNode : XMLToken { 133 private HandleRef swigCPtr; 134 XMLNode(IntPtr cPtr, bool cMemoryOwn)135 internal XMLNode(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.XMLNode_SWIGUpcast(cPtr), cMemoryOwn) 136 { 137 //super(libsbmlPINVOKE.XMLNodeUpcast(cPtr), cMemoryOwn); 138 swigCPtr = new HandleRef(this, cPtr); 139 } 140 getCPtr(XMLNode obj)141 internal static HandleRef getCPtr(XMLNode obj) 142 { 143 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 144 } 145 getCPtrAndDisown(XMLNode obj)146 internal static HandleRef getCPtrAndDisown (XMLNode obj) 147 { 148 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 149 150 if (obj != null) 151 { 152 ptr = obj.swigCPtr; 153 obj.swigCMemOwn = false; 154 } 155 156 return ptr; 157 } 158 Dispose(bool disposing)159 protected override void Dispose(bool disposing) { 160 lock(this) { 161 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 162 if (swigCMemOwn) { 163 swigCMemOwn = false; 164 libsbmlPINVOKE.delete_XMLNode(swigCPtr); 165 } 166 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 167 } 168 base.Dispose(disposing); 169 } 170 } 171 operator ==(XMLNode lhs, XMLNode rhs)172 public static bool operator==(XMLNode lhs, XMLNode rhs) 173 { 174 if((Object)lhs == (Object)rhs) 175 { 176 return true; 177 } 178 179 if( ((Object)lhs == null) || ((Object)rhs == null) ) 180 { 181 return false; 182 } 183 184 return (getCPtr(lhs).Handle.ToString() == getCPtr(rhs).Handle.ToString()); 185 } 186 operator !=(XMLNode lhs, XMLNode rhs)187 public static bool operator!=(XMLNode lhs, XMLNode rhs) 188 { 189 return !(lhs == rhs); 190 } 191 Equals(Object sb)192 public override bool Equals(Object sb) 193 { 194 if ( ! (sb is XMLNode) ) 195 { 196 return false; 197 } 198 199 return this == (XMLNode)sb; 200 } 201 GetHashCode()202 public override int GetHashCode() 203 { 204 return swigCPtr.Handle.ToInt32(); 205 } 206 207 208 /** 209 * Creates a new empty XMLNode with no children. 210 */ public XMLNode()211 XMLNode() : this(libsbmlPINVOKE.new_XMLNode__SWIG_0(), true) { 212 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 213 } 214 215 216 /** 217 * Creates a new XMLNode by copying an XMLToken object. 218 * 219 * @param token XMLToken to be copied to XMLNode. 220 */ public XMLNode(XMLToken token)221 XMLNode(XMLToken token) : this(libsbmlPINVOKE.new_XMLNode__SWIG_1(XMLToken.getCPtr(token)), true) { 222 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 223 } 224 225 226 /** 227 * Creates a new start element XMLNode with the given set of attributes and 228 * namespace declarations. 229 * 230 * @param triple XMLTriple. 231 * @param attributes XMLAttributes, the attributes to set. 232 * @param namespaces XMLNamespaces, the namespaces to set. 233 * @param line a long integer, the line number (default = 0). 234 * @param column a long integer, the column number (default = 0). 235 * 236 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 237 */ public XMLNode(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces, long line, long column)238 XMLNode(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces, long line, long column) : this(libsbmlPINVOKE.new_XMLNode__SWIG_2(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes), XMLNamespaces.getCPtr(namespaces), line, column), true) { 239 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 240 } 241 242 243 /** 244 * Creates a new start element XMLNode with the given set of attributes and 245 * namespace declarations. 246 * 247 * @param triple XMLTriple. 248 * @param attributes XMLAttributes, the attributes to set. 249 * @param namespaces XMLNamespaces, the namespaces to set. 250 * @param line a long integer, the line number (default = 0). 251 * @param column a long integer, the column number (default = 0). 252 * 253 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 254 */ public XMLNode(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces, long line)255 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) { 256 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 257 } 258 259 260 /** 261 * Creates a new start element XMLNode with the given set of attributes and 262 * namespace declarations. 263 * 264 * @param triple XMLTriple. 265 * @param attributes XMLAttributes, the attributes to set. 266 * @param namespaces XMLNamespaces, the namespaces to set. 267 * @param line a long integer, the line number (default = 0). 268 * @param column a long integer, the column number (default = 0). 269 * 270 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 271 */ public XMLNode(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces)272 XMLNode(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces) : this(libsbmlPINVOKE.new_XMLNode__SWIG_4(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes), XMLNamespaces.getCPtr(namespaces)), true) { 273 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 274 } 275 276 277 /** 278 * Creates a start element XMLNode with the given set of attributes. 279 * 280 * @param triple XMLTriple. 281 * @param attributes XMLAttributes, the attributes to set. 282 * @param line a long integer, the line number (default = 0). 283 * @param column a long integer, the column number (default = 0). 284 * 285 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 286 */ public XMLNode(XMLTriple triple, XMLAttributes attributes, long line, long column)287 XMLNode(XMLTriple triple, XMLAttributes attributes, long line, long column) : this(libsbmlPINVOKE.new_XMLNode__SWIG_5(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes), line, column), true) { 288 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 289 } 290 291 292 /** 293 * Creates a start element XMLNode with the given set of attributes. 294 * 295 * @param triple XMLTriple. 296 * @param attributes XMLAttributes, the attributes to set. 297 * @param line a long integer, the line number (default = 0). 298 * @param column a long integer, the column number (default = 0). 299 * 300 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 301 */ public XMLNode(XMLTriple triple, XMLAttributes attributes, long line)302 XMLNode(XMLTriple triple, XMLAttributes attributes, long line) : this(libsbmlPINVOKE.new_XMLNode__SWIG_6(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes), line), true) { 303 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 304 } 305 306 307 /** 308 * Creates a start element XMLNode with the given set of attributes. 309 * 310 * @param triple XMLTriple. 311 * @param attributes XMLAttributes, the attributes to set. 312 * @param line a long integer, the line number (default = 0). 313 * @param column a long integer, the column number (default = 0). 314 * 315 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 316 */ public XMLNode(XMLTriple triple, XMLAttributes attributes)317 XMLNode(XMLTriple triple, XMLAttributes attributes) : this(libsbmlPINVOKE.new_XMLNode__SWIG_7(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes)), true) { 318 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 319 } 320 321 322 /** 323 * Creates an end element XMLNode. 324 * 325 * @param triple XMLTriple. 326 * @param line a long integer, the line number (default = 0). 327 * @param column a long integer, the column number (default = 0). 328 * 329 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 330 */ public XMLNode(XMLTriple triple, long line, long column)331 XMLNode(XMLTriple triple, long line, long column) : this(libsbmlPINVOKE.new_XMLNode__SWIG_8(XMLTriple.getCPtr(triple), line, column), true) { 332 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 333 } 334 335 336 /** 337 * Creates an end element XMLNode. 338 * 339 * @param triple XMLTriple. 340 * @param line a long integer, the line number (default = 0). 341 * @param column a long integer, the column number (default = 0). 342 * 343 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 344 */ public XMLNode(XMLTriple triple, long line)345 XMLNode(XMLTriple triple, long line) : this(libsbmlPINVOKE.new_XMLNode__SWIG_9(XMLTriple.getCPtr(triple), line), true) { 346 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 347 } 348 349 350 /** 351 * Creates an end element XMLNode. 352 * 353 * @param triple XMLTriple. 354 * @param line a long integer, the line number (default = 0). 355 * @param column a long integer, the column number (default = 0). 356 * 357 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 358 */ public XMLNode(XMLTriple triple)359 XMLNode(XMLTriple triple) : this(libsbmlPINVOKE.new_XMLNode__SWIG_10(XMLTriple.getCPtr(triple)), true) { 360 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 361 } 362 363 364 /** 365 * Creates a text XMLNode. 366 * 367 * @param chars a string, the text to be added to the XMLToken. 368 * @param line a long integer, the line number (default = 0). 369 * @param column a long integer, the column number (default = 0). 370 * 371 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 372 */ public XMLNode(string chars, long line, long column)373 XMLNode(string chars, long line, long column) : this(libsbmlPINVOKE.new_XMLNode__SWIG_11(chars, line, column), true) { 374 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 375 } 376 377 378 /** 379 * Creates a text XMLNode. 380 * 381 * @param chars a string, the text to be added to the XMLToken. 382 * @param line a long integer, the line number (default = 0). 383 * @param column a long integer, the column number (default = 0). 384 * 385 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 386 */ public XMLNode(string chars, long line)387 XMLNode(string chars, long line) : this(libsbmlPINVOKE.new_XMLNode__SWIG_12(chars, line), true) { 388 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 389 } 390 391 392 /** 393 * Creates a text XMLNode. 394 * 395 * @param chars a string, the text to be added to the XMLToken. 396 * @param line a long integer, the line number (default = 0). 397 * @param column a long integer, the column number (default = 0). 398 * 399 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 400 */ public XMLNode(string chars)401 XMLNode(string chars) : this(libsbmlPINVOKE.new_XMLNode__SWIG_13(chars), true) { 402 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 403 } 404 405 406 /** */ /* libsbml-internal */ public XMLNode(XMLInputStream stream)407 XMLNode(XMLInputStream stream) : this(libsbmlPINVOKE.new_XMLNode__SWIG_14(XMLInputStream.getCPtr(stream)), true) { 408 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 409 } 410 411 412 /** 413 * Copy constructor; creates a copy of this XMLNode. 414 * 415 * @param orig the XMLNode instance to copy. 416 */ public XMLNode(XMLNode orig)417 XMLNode(XMLNode orig) : this(libsbmlPINVOKE.new_XMLNode__SWIG_15(XMLNode.getCPtr(orig)), true) { 418 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 419 } 420 421 422 /** 423 * Creates and returns a deep copy of this XMLNode object. 424 * 425 * @return the (deep) copy of this XMLNode object. 426 */ public new clone()427 XMLNode clone() { 428 global::System.IntPtr cPtr = libsbmlPINVOKE.XMLNode_clone(swigCPtr); 429 XMLNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new XMLNode(cPtr, true); 430 return ret; 431 } 432 433 434 /** 435 * Adds a copy of @p node as a child of this XMLNode. 436 * 437 * The given @p node is added at the end of the list of children. 438 * 439 * @param node the XMLNode to be added as child. 440 * 441 * 442 * @return integer value indicating success/failure of the 443 * function. @if clike The value is drawn from the 444 * enumeration #OperationReturnValues_t. @endif The possible values 445 * returned by this function are: 446 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 447 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 448 * @li @link libsbml#LIBSBML_INVALID_XML_OPERATION LIBSBML_INVALID_XML_OPERATION@endlink 449 * 450 * @note The given node is added at the end of the children list. 451 */ public addChild(XMLNode node)452 int addChild(XMLNode node) { 453 int ret = libsbmlPINVOKE.XMLNode_addChild(swigCPtr, XMLNode.getCPtr(node)); 454 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 455 return ret; 456 } 457 458 459 /** 460 * Inserts a copy of the given node as the <code>n</code>th child of this 461 * XMLNode. 462 * 463 * If the given index @p n is out of range for this XMLNode instance, 464 * the @p node is added at the end of the list of children. Even in 465 * that situation, this method does not throw an error. 466 * 467 * @param n an integer, the index at which the given node is inserted. 468 * @param node an XMLNode to be inserted as <code>n</code>th child. 469 * 470 * @return a reference to the newly-inserted child @p node. 471 */ public insertChild(long n, XMLNode node)472 XMLNode insertChild(long n, XMLNode node) { 473 XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_insertChild(swigCPtr, n, XMLNode.getCPtr(node)), false); 474 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 475 return ret; 476 } 477 478 479 /** 480 * Removes the <code>n</code>th child of this XMLNode and returns the 481 * removed node. 482 * 483 * It is important to keep in mind that a given XMLNode may have more 484 * than one child. Calling this method erases all existing references to 485 * child nodes @em after the given position @p n. If the index @p n is 486 * greater than the number of child nodes in this XMLNode, this method 487 * takes no action (and returns @c null). 488 * 489 * @param n an integer, the index of the node to be removed. 490 * 491 * @return the removed child, or @c null if @p n is greater than the number 492 * of children in this node. 493 * 494 * @note The caller owns the returned node and is responsible for deleting it. 495 */ public removeChild(long n)496 XMLNode removeChild(long n) { 497 global::System.IntPtr cPtr = libsbmlPINVOKE.XMLNode_removeChild(swigCPtr, n); 498 XMLNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new XMLNode(cPtr, true); 499 return ret; 500 } 501 502 503 /** 504 * Removes all children from this node. 505 * 506 * @return integer value indicating success/failure of the 507 * function. @if clike The value is drawn from the 508 * enumeration #OperationReturnValues_t. @endif The possible values 509 * returned by this function are: 510 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 511 */ public removeChildren()512 int removeChildren() { 513 int ret = libsbmlPINVOKE.XMLNode_removeChildren(swigCPtr); 514 return ret; 515 } 516 517 518 /** 519 * Returns the <code>n</code>th child of this XMLNode. 520 * 521 * If the index @p n is greater than the number of child nodes, 522 * this method returns an empty node. 523 * 524 * @param n a long integereger, the index of the node to return. 525 * 526 * @return the <code>n</code>th child of this XMLNode. 527 */ public getChild(long n)528 XMLNode getChild(long n) { 529 XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_getChild__SWIG_0(swigCPtr, n), false); 530 return ret; 531 } 532 533 534 /** 535 * Returns the first child of this XMLNode with the corresponding name. 536 * 537 * If no child with corrsponding name can be found, 538 * this method returns an empty node. 539 * 540 * @param name the name of the node to return. 541 * 542 * @return the first child of this XMLNode with given name. 543 */ public getChild(string name)544 XMLNode getChild(string name) { 545 XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_getChild__SWIG_2(swigCPtr, name), false); 546 return ret; 547 } 548 549 550 /** 551 * Return the index of the first child of this XMLNode with the given name. 552 * 553 * @param name a string, the name of the child for which the 554 * index is required. 555 * 556 * @return the index of the first child of this XMLNode with the given 557 * name, or @c -1 if not present. 558 */ public getIndex(string name)559 int getIndex(string name) { 560 int ret = libsbmlPINVOKE.XMLNode_getIndex(swigCPtr, name); 561 return ret; 562 } 563 564 565 /** 566 * Return a boolean indicating whether this XMLNode has a child with the 567 * given name. 568 * 569 * @param name a string, the name of the child to be checked. 570 * 571 * @return boolean indicating whether this XMLNode has a child with the 572 * given name. 573 */ public hasChild(string name)574 bool hasChild(string name) { 575 bool ret = libsbmlPINVOKE.XMLNode_hasChild(swigCPtr, name); 576 return ret; 577 } 578 579 580 /** 581 * Compare this XMLNode against another XMLNode returning true if both 582 * nodes represent the same XML tree, or false otherwise. 583 * 584 * @param other another XMLNode to compare against. 585 * 586 * @param ignoreURI whether to ignore the namespace URI when doing the 587 * comparison. 588 * 589 * @param ignoreAttributeValues whetehr to ignore attribute values when 590 * doing the comparison. 591 * 592 * @return boolean indicating whether this XMLNode represents the same XML 593 * tree as another. 594 */ public equals(XMLNode other, bool ignoreURI, bool ignoreAttributeValues)595 bool equals(XMLNode other, bool ignoreURI, bool ignoreAttributeValues) { 596 bool ret = libsbmlPINVOKE.XMLNode_equals__SWIG_0(swigCPtr, XMLNode.getCPtr(other), ignoreURI, ignoreAttributeValues); 597 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 598 return ret; 599 } 600 601 602 /** 603 * Compare this XMLNode against another XMLNode returning true if both 604 * nodes represent the same XML tree, or false otherwise. 605 * 606 * @param other another XMLNode to compare against. 607 * 608 * @param ignoreURI whether to ignore the namespace URI when doing the 609 * comparison. 610 * 611 * @param ignoreAttributeValues whetehr to ignore attribute values when 612 * doing the comparison. 613 * 614 * @return boolean indicating whether this XMLNode represents the same XML 615 * tree as another. 616 */ public equals(XMLNode other, bool ignoreURI)617 bool equals(XMLNode other, bool ignoreURI) { 618 bool ret = libsbmlPINVOKE.XMLNode_equals__SWIG_1(swigCPtr, XMLNode.getCPtr(other), ignoreURI); 619 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 620 return ret; 621 } 622 623 624 /** 625 * Compare this XMLNode against another XMLNode returning true if both 626 * nodes represent the same XML tree, or false otherwise. 627 * 628 * @param other another XMLNode to compare against. 629 * 630 * @param ignoreURI whether to ignore the namespace URI when doing the 631 * comparison. 632 * 633 * @param ignoreAttributeValues whetehr to ignore attribute values when 634 * doing the comparison. 635 * 636 * @return boolean indicating whether this XMLNode represents the same XML 637 * tree as another. 638 */ public equals(XMLNode other)639 bool equals(XMLNode other) { 640 bool ret = libsbmlPINVOKE.XMLNode_equals__SWIG_2(swigCPtr, XMLNode.getCPtr(other)); 641 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 642 return ret; 643 } 644 645 646 /** 647 * Returns the number of children for this XMLNode. 648 * 649 * @return the number of children for this XMLNode. 650 */ public getNumChildren()651 long getNumChildren() { return (long)libsbmlPINVOKE.XMLNode_getNumChildren(swigCPtr); } 652 653 654 /** */ /* libsbml-internal */ public writeToStream(XMLOutputStream stream)655 void writeToStream(XMLOutputStream stream) { 656 libsbmlPINVOKE.XMLNode_writeToStream(swigCPtr, XMLOutputStream.getCPtr(stream)); 657 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 658 } 659 660 661 /** 662 * Returns a string representation of this XMLNode. 663 * 664 * @return a string derived from this XMLNode. 665 */ public toXMLString()666 string toXMLString() { 667 string ret = libsbmlPINVOKE.XMLNode_toXMLString(swigCPtr); 668 return ret; 669 } 670 671 672 /** 673 * Returns a string representation of a given XMLNode. 674 * 675 * @param node the XMLNode to be represented as a string. 676 * 677 * @return a string-form representation of @p node. 678 */ public convertXMLNodeToString(XMLNode node)679 static string convertXMLNodeToString(XMLNode node) { 680 string ret = libsbmlPINVOKE.XMLNode_convertXMLNodeToString(XMLNode.getCPtr(node)); 681 return ret; 682 } 683 684 685 /** 686 * Returns an XMLNode which is derived from a string containing XML 687 * content. 688 * 689 * The XML namespace must be defined using argument @p xmlns if the 690 * corresponding XML namespace attribute is not part of the string of the 691 * first argument. 692 * 693 * @param xmlstr string to be converted to a XML node. 694 * @param xmlns XMLNamespaces the namespaces to set (default value is @c null). 695 * 696 * @note The caller owns the returned XMLNode and is reponsible for 697 * deleting it. The returned XMLNode object is a dummy root (container) 698 * XMLNode if the top-level element in the given XML string is NOT 699 * <code><html></code>, <code><body></code>, 700 * <code><annotation></code>, or <code><notes></code>. In 701 * the dummy root node, each top-level element in the given XML string is 702 * contained as a child XMLNode. XMLToken::isEOF() can be used to 703 * identify if the returned XMLNode object is a dummy node. 704 * 705 * @return a XMLNode which is converted from string @p xmlstr. If the 706 * conversion failed, this method returns @c null. 707 * 708 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 709 */ public convertStringToXMLNode(string xmlstr, XMLNamespaces xmlns)710 static XMLNode convertStringToXMLNode(string xmlstr, XMLNamespaces xmlns) { 711 global::System.IntPtr cPtr = libsbmlPINVOKE.XMLNode_convertStringToXMLNode__SWIG_0(xmlstr, XMLNamespaces.getCPtr(xmlns)); 712 XMLNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new XMLNode(cPtr, true); 713 return ret; 714 } 715 716 717 /** 718 * Returns an XMLNode which is derived from a string containing XML 719 * content. 720 * 721 * The XML namespace must be defined using argument @p xmlns if the 722 * corresponding XML namespace attribute is not part of the string of the 723 * first argument. 724 * 725 * @param xmlstr string to be converted to a XML node. 726 * @param xmlns XMLNamespaces the namespaces to set (default value is @c null). 727 * 728 * @note The caller owns the returned XMLNode and is reponsible for 729 * deleting it. The returned XMLNode object is a dummy root (container) 730 * XMLNode if the top-level element in the given XML string is NOT 731 * <code><html></code>, <code><body></code>, 732 * <code><annotation></code>, or <code><notes></code>. In 733 * the dummy root node, each top-level element in the given XML string is 734 * contained as a child XMLNode. XMLToken::isEOF() can be used to 735 * identify if the returned XMLNode object is a dummy node. 736 * 737 * @return a XMLNode which is converted from string @p xmlstr. If the 738 * conversion failed, this method returns @c null. 739 * 740 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 741 */ public convertStringToXMLNode(string xmlstr)742 static XMLNode convertStringToXMLNode(string xmlstr) { 743 global::System.IntPtr cPtr = libsbmlPINVOKE.XMLNode_convertStringToXMLNode__SWIG_1(xmlstr); 744 XMLNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new XMLNode(cPtr, true); 745 return ret; 746 } 747 748 } 749 750 } 751