1 /** 2 * @file XMLNamespaces.h 3 * @brief A list of XMLNamespace declarations (URI/prefix pairs) 4 * @author Ben Bornstein 5 * 6 * <!-------------------------------------------------------------------------- 7 * This file is part of libSBML. Please visit http://sbml.org for more 8 * information about SBML, and the latest version of libSBML. 9 * 10 * Copyright (C) 2020 jointly by the following organizations: 11 * 1. California Institute of Technology, Pasadena, CA, USA 12 * 2. University of Heidelberg, Heidelberg, Germany 13 * 3. University College London, London, UK 14 * 15 * Copyright (C) 2019 jointly by the following organizations: 16 * 1. California Institute of Technology, Pasadena, CA, USA 17 * 2. University of Heidelberg, Heidelberg, Germany 18 * 19 * Copyright (C) 2013-2018 jointly by the following organizations: 20 * 1. California Institute of Technology, Pasadena, CA, USA 21 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 22 * 3. University of Heidelberg, Heidelberg, Germany 23 * 24 * Copyright (C) 2009-2013 jointly by the following organizations: 25 * 1. California Institute of Technology, Pasadena, CA, USA 26 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 27 * 28 * Copyright (C) 2006-2008 by the California Institute of Technology, 29 * Pasadena, CA, USA 30 * 31 * Copyright (C) 2002-2005 jointly by the following organizations: 32 * 1. California Institute of Technology, Pasadena, CA, USA 33 * 2. Japan Science and Technology Agency, Japan 34 * 35 * This library is free software; you can redistribute it and/or modify it 36 * under the terms of the GNU Lesser General Public License as published by 37 * the Free Software Foundation. A copy of the license agreement is provided 38 * in the file named "LICENSE.txt" included with this software distribution 39 * and also available online as http://sbml.org/software/libsbml/license.html 40 * ------------------------------------------------------------------------ --> 41 * 42 * @class XMLNamespaces 43 * @sbmlbrief{core} An XML Namespace. 44 * 45 * @htmlinclude not-sbml-warning.html 46 * 47 * This class serves to organize functionality for tracking XML namespaces 48 * in a document or data stream. The namespace declarations are stored as 49 * a list of pairs of XML namespace URIs and prefix strings. These 50 * correspond to the parts of a namespace declaration on an XML element. 51 * For example, in the following XML fragment, 52 * @verbatim 53 <annotation> 54 <mysim:nodecolors xmlns:mysim="urn:lsid:mysim.org" 55 mysim:bgcolor="green" mysim:fgcolor="white"/> 56 </annotation> 57 @endverbatim 58 * there is one namespace declaration. Its URI is 59 * <code>urn:lsid:mysim.org</code> and its prefix is <code>mysim</code>. 60 * This pair could be stored as one item in an XMLNamespaces list. 61 * 62 * XMLNamespaces provides various methods for manipulating the list of 63 * prefix-URI pairs. Individual namespaces stored in a given XMLNamespace 64 * object instance can be retrieved based on their index using 65 * XMLNamespaces::getPrefix(int index), or by their characteristics such as 66 * their URI or position in the list. 67 */ 68 69 #ifndef XMLNamespaces_h 70 #define XMLNamespaces_h 71 72 #include <sbml/xml/XMLExtern.h> 73 #include <sbml/common/sbmlfwd.h> 74 #include <sbml/common/operationReturnValues.h> 75 76 77 #ifdef __cplusplus 78 79 #include <string> 80 #include <vector> 81 82 LIBSBML_CPP_NAMESPACE_BEGIN 83 84 /** @cond doxygenLibsbmlInternal */ 85 class XMLOutputStream; 86 /** @endcond */ 87 88 89 class LIBLAX_EXTERN XMLNamespaces 90 { 91 public: 92 93 /** 94 * Creates a new empty list of XML namespace declarations. 95 */ 96 XMLNamespaces (); 97 98 99 /** 100 * Destroys this list of XML namespace declarations. 101 */ 102 virtual ~XMLNamespaces (); 103 104 105 /** 106 * Copy constructor; creates a copy of this XMLNamespaces list. 107 * 108 * @param orig the XMLNamespaces object to copy. 109 */ 110 XMLNamespaces(const XMLNamespaces& orig); 111 112 113 /** 114 * Assignment operator for XMLNamespaces. 115 * 116 * @param rhs the XMLNamespaces object whose values are used as the basis 117 * of the assignment. 118 */ 119 XMLNamespaces& operator=(const XMLNamespaces& rhs); 120 121 122 /** 123 * Creates and returns a deep copy of this XMLNamespaces object. 124 * 125 * @return the (deep) copy of this XMLNamespaces object. 126 */ 127 XMLNamespaces* clone () const; 128 129 130 /** 131 * Appends an XML namespace prefix and URI pair to this list of namespace 132 * declarations. 133 * 134 * An XMLNamespaces object stores a list of pairs of namespaces and their 135 * prefixes. If there is an XML namespace with the given @p uri prefix 136 * in this list, then its corresponding URI will be overwritten by the 137 * new @p uri unless the uri represents the core sbml namespace. 138 * Calling programs could use one of the other XMLNamespaces 139 * methods, such as 140 * XMLNamespaces::hasPrefix(@if java String@endif) and 141 * XMLNamespaces::hasURI(@if java String@endif) to 142 * inquire whether a given prefix and/or URI 143 * is already present in this XMLNamespaces object. 144 * If the @p uri represents the sbml namespaces then it will not be 145 * overwritten, as this has potentially serious consequences. If it 146 * is necessary to replace the sbml namespace the namespace should be removed 147 * prior to adding the new namespace. 148 * 149 * @param uri a string, the uri for the namespace. 150 * @param prefix a string, the prefix for the namespace. 151 * 152 * @copydetails doc_returns_success_code 153 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 154 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 155 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 156 * 157 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif@~ 158 */ 159 int add (const std::string& uri, const std::string prefix = ""); 160 161 162 /** 163 * Removes an XML Namespace stored in the given position of this list. 164 * 165 * @param index an integer, position of the namespace to remove. 166 * 167 * @copydetails doc_returns_success_code 168 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 169 * @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t} 170 */ 171 int remove (int index); 172 173 174 /** 175 * Removes an XML Namespace with the given prefix. 176 * 177 * @param prefix a string, prefix of the required namespace. 178 * 179 * @copydetails doc_returns_success_code 180 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 181 * @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t} 182 * 183 * @see remove(int index) 184 */ 185 int remove (const std::string& prefix); 186 187 188 /** 189 * Clears (deletes) all XML namespace declarations in this XMLNamespaces 190 * object. 191 * 192 * @copydetails doc_returns_success_code 193 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 194 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 195 * 196 * @see remove(int index) 197 */ 198 int clear (); 199 200 201 /** 202 * Look up the index of an XML namespace declaration by URI. 203 * 204 * An XMLNamespaces object stores a list of pairs of namespaces and their 205 * prefixes. If this XMLNamespaces object contains a pair with the given 206 * URI @p uri, this method returns its index in the list. 207 * 208 * @param uri a string, the URI of the sought-after namespace. 209 * 210 * @return the index of the given declaration, or <code>-1</code> if not 211 * present. 212 */ 213 int getIndex (const std::string& uri) const; 214 215 /** 216 * Tests whether the given uri is contained in this set of namespaces. 217 * 218 */ 219 bool containsUri(const std::string& uri) const; 220 221 /** 222 * Look up the index of an XML namespace declaration by @p prefix. 223 * 224 * An XMLNamespaces object stores a list of pairs of namespaces and their 225 * prefixes. If this XMLNamespaces object contains a pair with the given 226 * prefix @p prefix, this method returns its index in the list. 227 * 228 * @param prefix a string, the prefix string of the sought-after 229 * namespace. 230 * 231 * @return the index of the given declaration, or <code>-1</code> if not 232 * present. 233 */ 234 int getIndexByPrefix (const std::string& prefix) const; 235 236 237 /** 238 * Returns the total number of URI-and-prefix pairs stored in this 239 * particular XMLNamespaces instance. 240 * 241 * @return the number of namespaces in this list. 242 */ 243 int getLength () const; 244 245 246 /** 247 * Returns the total number of URI-and-prefix pairs stored in this 248 * particular XMLNamespaces instance. 249 * 250 * @return the number of namespaces in this list. 251 * 252 * This function is an alias for getLength introduced for consistency 253 * with other XML classes. 254 */ 255 int getNumNamespaces () const; 256 257 258 /** 259 * Look up the prefix of an XML namespace declaration by its position. 260 * 261 * An XMLNamespaces object stores a list of pairs of namespaces and their 262 * prefixes. This method returns the prefix of the <code>n</code>th 263 * element in that list (if it exists). Callers should use 264 * XMLAttributes::getLength() first to find out how many namespaces are 265 * stored in the list. 266 * 267 * @param index an integer, position of the sought-after prefix. 268 * 269 * @return the prefix of an XML namespace declaration in this list (by 270 * position), or an empty string if the @p index is out of range. 271 * 272 * @see getLength() 273 */ 274 std::string getPrefix (int index) const; 275 276 277 /** 278 * Look up the prefix of an XML namespace declaration by its URI. 279 * 280 * An XMLNamespaces object stores a list of pairs of namespaces and their 281 * prefixes. This method returns the prefix for a pair that has the 282 * given @p uri. 283 * 284 * @param uri a string, the URI of the prefix being sought. 285 * 286 * @return the prefix of an XML namespace declaration given its URI, or 287 * an empty string if no such @p uri exists in this XMLNamespaces object. 288 */ 289 std::string getPrefix (const std::string& uri) const; 290 291 292 /** 293 * Look up the URI of an XML namespace declaration by its position. 294 * 295 * An XMLNamespaces object stores a list of pairs of namespaces and their 296 * prefixes. This method returns the URI of the <code>n</code>th element 297 * in that list (if it exists). Callers should use 298 * XMLAttributes::getLength() first to find out how many namespaces are 299 * stored in the list. 300 * 301 * @param index an integer, position of the required URI. 302 * 303 * @return the URI of an XML namespace declaration in this list (by 304 * position), or an empty string if the @p index is out of range. 305 * 306 * @see getLength() 307 */ 308 std::string getURI (int index) const; 309 310 311 /** 312 * Look up the URI of an XML namespace declaration by its prefix. 313 * 314 * An XMLNamespaces object stores a list of pairs of namespaces and their 315 * prefixes. This method returns the namespace URI for a pair that has 316 * the given @p prefix. 317 * 318 * @param prefix a string, the prefix of the required URI. 319 * 320 * @return the URI of an XML namespace declaration having the given @p 321 * prefix, or an empty string if no such prefix-and-URI pair exists 322 * in this XMLNamespaces object. 323 * 324 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif@~ 325 * 326 * @see getURI() 327 */ 328 std::string getURI (const std::string prefix = "") const; 329 330 331 /** 332 * Predicate returning @c true or @c false depending on whether this 333 * XMLNamespaces list is empty. 334 * 335 * @return @c true if this XMLNamespaces list is empty, @c false otherwise. 336 */ 337 bool isEmpty () const; 338 339 340 /** 341 * Predicate returning @c true or @c false depending on whether an XML 342 * Namespace with the given URI is contained in this XMLNamespaces list. 343 * 344 * @param uri a string, the uri for the namespace. 345 * 346 * @return @c true if an XML Namespace with the given URI is contained in 347 * this XMLNamespaces list, @c false otherwise. 348 */ 349 bool hasURI(const std::string& uri) const; 350 351 352 /** 353 * Predicate returning @c true or @c false depending on whether an XML 354 * Namespace with the given prefix is contained in this XMLNamespaces 355 * list. 356 * 357 * @param prefix a string, the prefix for the namespace. 358 * 359 * @return @c true if an XML Namespace with the given URI is contained in 360 * this XMLNamespaces list, @c false otherwise. 361 */ 362 bool hasPrefix(const std::string& prefix) const; 363 364 365 /** 366 * Predicate returning @c true or @c false depending on whether an XML 367 * Namespace with the given URI and prefix pair is contained in this 368 * XMLNamespaces list. 369 * 370 * @param uri a string, the URI for the namespace. 371 * @param prefix a string, the prefix for the namespace. 372 * 373 * @return @c true if an XML Namespace with the given uri/prefix pair is 374 * contained in this XMLNamespaces list, @c false otherwise. 375 */ 376 bool hasNS(const std::string& uri, const std::string& prefix) const; 377 378 379 #ifndef SWIG 380 381 /** @cond doxygenLibsbmlInternal */ 382 /** 383 * Writes this XMLNamespaces list to stream. 384 * 385 * @param stream XMLOutputStream, stream to which this XMLNamespaces 386 * list is to be written. 387 */ 388 void write (XMLOutputStream& stream) const; 389 390 391 /** 392 * Inserts this XMLNamespaces list into stream. 393 * 394 * @param stream XMLOutputStream, stream to which the XMLNamespaces 395 * list is to be written. 396 * @param namespaces XMLNamespaces, namespaces to be written to stream. 397 * 398 * @return the stream with the namespaces inserted. 399 */ 400 LIBLAX_EXTERN 401 friend XMLOutputStream& 402 operator<< (XMLOutputStream& stream, const XMLNamespaces& namespaces); 403 404 /** @endcond */ 405 406 #endif /* !SWIG */ 407 408 /** @cond doxygenLibsbmlInternal */ 409 friend class SBase; 410 411 /** @endcond */ 412 413 protected: 414 /** @cond doxygenLibsbmlInternal */ 415 /** 416 * Removes the default XML namespace. 417 */ 418 void removeDefault (); 419 420 421 bool containIdenticalSetNS(XMLNamespaces* rhs); 422 423 typedef std::pair<std::string, std::string> PrefixURIPair; 424 std::vector<PrefixURIPair> mNamespaces; 425 426 /** @endcond */ 427 }; 428 429 430 LIBSBML_CPP_NAMESPACE_END 431 432 #endif /* __cplusplus */ 433 434 435 #ifndef SWIG 436 437 LIBSBML_CPP_NAMESPACE_BEGIN 438 BEGIN_C_DECLS 439 440 /** 441 * Creates a new empty XMLNamespaces_t structure. 442 * 443 * @memberof XMLNamespaces_t 444 */ 445 LIBLAX_EXTERN 446 XMLNamespaces_t * 447 XMLNamespaces_create (void); 448 449 450 /** 451 * Frees the given XMLNamespaces_t structure. 452 * 453 * @param ns XMLNamespaces structure to be freed. 454 ** 455 * @memberof XMLNamespaces_t 456 */ 457 LIBLAX_EXTERN 458 void 459 XMLNamespaces_free (XMLNamespaces_t *ns); 460 461 462 /** 463 * Creates a deep copy of the given XMLNamespaces_t structure 464 * 465 * @param ns the XMLNamespaces_t structure to be copied. 466 * 467 * @return a (deep) copy of the given XMLNamespaces_t structure. 468 * 469 * @memberof XMLNamespaces_t 470 */ 471 LIBLAX_EXTERN 472 XMLNamespaces_t * 473 XMLNamespaces_clone (const XMLNamespaces_t* ns); 474 475 476 /** 477 * Appends an XML namespace prefix/URI pair to this XMLNamespaces_t 478 * structure. 479 * 480 * @param ns the XMLNamespaces_t structure. 481 * @param uri a string, the uri for the namespace. 482 * @param prefix a string, the prefix for the namespace. 483 * 484 * @copydetails doc_returns_success_code 485 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 486 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 487 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 488 * 489 * @memberof XMLNamespaces_t 490 */ 491 LIBLAX_EXTERN 492 int 493 XMLNamespaces_add (XMLNamespaces_t *ns, 494 const char *uri, const char *prefix); 495 496 497 /** 498 * Removes an XML Namespace stored in the given position of this list. 499 * 500 * @param ns XMLNamespaces structure. 501 * @param index an integer, position of the removed namespace. 502 * 503 * @copydetails doc_returns_success_code 504 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 505 * @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t} 506 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 507 * 508 * @memberof XMLNamespaces_t 509 */ 510 LIBLAX_EXTERN 511 int 512 XMLNamespaces_remove (XMLNamespaces_t *ns, int index); 513 514 515 /** 516 * Removes an XML Namespace with the given @p prefix. 517 * 518 * @param ns XMLNamespaces structure. 519 * @param prefix a string, prefix of the required namespace. 520 * 521 * @copydetails doc_returns_success_code 522 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 523 * @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t} 524 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 525 * 526 * @memberof XMLNamespaces_t 527 */ 528 LIBLAX_EXTERN 529 int 530 XMLNamespaces_removeByPrefix (XMLNamespaces_t *ns, const char* prefix); 531 532 533 /** 534 * Clears this XMLNamespaces_t structure. 535 * 536 * @param ns XMLNamespaces structure. 537 * 538 * @copydetails doc_returns_success_code 539 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 540 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 541 ** 542 * @memberof XMLNamespaces_t 543 */ 544 LIBLAX_EXTERN 545 int 546 XMLNamespaces_clear (XMLNamespaces_t *ns); 547 548 549 /** 550 * Lookup the index of an XML namespace declaration by URI. 551 * 552 * @param ns the XMLNamespaces_t structure. 553 * @param uri a string, uri of the required namespace. 554 * 555 * @return the index of the given declaration, or @c -1 if not present. 556 * 557 * @memberof XMLNamespaces_t 558 */ 559 LIBLAX_EXTERN 560 int 561 XMLNamespaces_getIndex (const XMLNamespaces_t *ns, const char *uri); 562 563 564 /** 565 * Look up the index of an XML namespace declaration by @p prefix. 566 * 567 * @param ns the XMLNamespaces_t structure. 568 * @param prefix a string, prefix of the required namespace. 569 * 570 * @return the index of the given declaration, or @c -1 if not present. 571 * 572 * @memberof XMLNamespaces_t 573 */ 574 LIBLAX_EXTERN 575 int XMLNamespaces_getIndexByPrefix (const XMLNamespaces_t *ns, const char* prefix); 576 577 578 /** 579 * Returns the total number of URI-and-prefix pairs stored in this 580 * particular XMLNamespaces instance. 581 * 582 * @param ns the XMLNamespaces_t structure. 583 * 584 * @return the number of namespaces in this list. 585 * 586 * @memberof XMLNamespaces_t 587 */ 588 LIBLAX_EXTERN 589 int 590 XMLNamespaces_getLength (const XMLNamespaces_t *ns); 591 592 593 /** 594 * Returns the total number of URI-and-prefix pairs stored in this 595 * particular XMLNamespaces instance. 596 * 597 * This function is an alias for getLength introduced for consistency 598 * with other XML classes. 599 * 600 * @param ns the XMLNamespaces_t structure. 601 * 602 * @return the number of namespaces in this list. 603 * 604 * @memberof XMLNamespaces_t 605 */ 606 LIBLAX_EXTERN 607 int 608 XMLNamespaces_getNumNamespaces (const XMLNamespaces_t *ns); 609 610 611 /** 612 * Look up the prefix of an XML namespace declaration by its position. 613 * 614 * An XMLNamespaces structure stores a list of pairs of namespaces and their 615 * prefixes. This method returns the prefix of the <code>n</code>th 616 * element in that list (if it exists). Callers should use 617 * XMLAttributes_getLength() first to find out how many namespaces are 618 * stored in the list. 619 * 620 * @param ns the XMLNamespaces_t structure. 621 * @param index an integer, position of the sought-after prefix. 622 * 623 * @return the prefix of an XML namespace declaration in this list (by 624 * position), or an empty string if the @p index is out of range 625 * 626 * @see XMLNamespaces_getLength() 627 * 628 * @memberof XMLNamespaces_t 629 */ 630 LIBLAX_EXTERN 631 char * 632 XMLNamespaces_getPrefix (const XMLNamespaces_t *ns, int index); 633 634 635 /** 636 * Look up the prefix of an XML namespace declaration by its URI. 637 * 638 * An XMLNamespaces structure stores a list of pairs of namespaces and their 639 * prefixes. This method returns the prefix for a pair that has the 640 * given @p uri. 641 * 642 * @param ns the XMLNamespaces_t structure. 643 * @param uri a string, the URI of the prefix being sought. 644 * 645 * @return the prefix of an XML namespace declaration given its URI, or 646 * an empty string if no such @p uri exists in this XMLNamespaces_t structure 647 * 648 * @memberof XMLNamespaces_t 649 */ 650 LIBLAX_EXTERN 651 char * 652 XMLNamespaces_getPrefixByURI (const XMLNamespaces_t *ns, const char *uri); 653 654 655 /** 656 * Look up the URI of an XML namespace declaration by its position. 657 * 658 * An XMLNamespaces structure stores a list of pairs of namespaces and their 659 * prefixes. This method returns the URI of the <code>n</code>th element 660 * in that list (if it exists). Callers should use 661 * XMLAttributes_getLength() first to find out how many namespaces are 662 * stored in the list. 663 * 664 * @param ns the XMLNamespaces_t structure. 665 * @param index an integer, position of the required URI. 666 * 667 * @return the URI of an XML namespace declaration in this list (by 668 * position), or an empty string if the @p index is out of range. 669 * 670 * @see XMLNamespaces_getLength() 671 * 672 * @memberof XMLNamespaces_t 673 */ 674 LIBLAX_EXTERN 675 char * 676 XMLNamespaces_getURI (const XMLNamespaces_t *ns, int index); 677 678 679 /** 680 * Look up the URI of an XML namespace declaration by its prefix. 681 * 682 * An XMLNamespaces object stores a list of pairs of namespaces and their 683 * prefixes. This method returns the namespace URI for a pair that has 684 * the given @p prefix. 685 * 686 * @param ns the XMLNamespaces_t structure. 687 * @param prefix a string, the prefix of the required URI. 688 * 689 * @return the URI of an XML namespace declaration having the given @p 690 * prefix, or an empty string if no such prefix-and-URI pair exists 691 * in this XMLNamespaces_t object 692 * 693 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif@~ 694 * 695 * @see getURI() 696 * 697 * @memberof XMLNamespaces_t 698 */ 699 LIBLAX_EXTERN 700 char * 701 XMLNamespaces_getURIByPrefix (const XMLNamespaces_t *ns, const char *prefix); 702 703 704 /** 705 * Predicate returning @c 1 (true) or @c 0 (false) depending on whether 706 * this XMLNamespaces_t list is empty. 707 * 708 * @return @c 1 (true) if this XMLNamespaces_t list is empty, @c 0 (false) otherwise. 709 * 710 * @memberof XMLNamespaces_t 711 */ 712 LIBLAX_EXTERN 713 int 714 XMLNamespaces_isEmpty (const XMLNamespaces_t *ns); 715 716 717 /** 718 * Predicate returning @c 1 (true) or @c 0 (false) depending on whether 719 * an XML Namespace with the given URI is contained in this XMLNamespaces_t list. 720 * 721 * @return @c 1 (true) if an XML Namespace with the given URI is contained in this 722 * XMLNamespaces list, @c 0 (false) otherwise. 723 * 724 * @memberof XMLNamespaces_t 725 */ 726 LIBLAX_EXTERN 727 int 728 XMLNamespaces_hasURI(const XMLNamespaces_t *ns, const char* uri); 729 730 731 /** 732 * Predicate returning @c 1 (true) or @c 0 (false) depending on whether 733 * an XML Namespace the given @p prefix is contained in this XMLNamespaces_t list. 734 * 735 * @return @c 1 (true) if an XML Namespace with the given URI is contained in this 736 * XMLNamespaces list, @c 0 (false) otherwise. 737 * 738 * @memberof XMLNamespaces_t 739 */ 740 LIBLAX_EXTERN 741 int 742 XMLNamespaces_hasPrefix(const XMLNamespaces_t *ns, const char* prefix); 743 744 745 /** 746 * Predicate returning @c 1 (true) or @c 0 (false) depending on whether 747 * an XML Namespace with the given URI is contained in this XMLNamespaces_t list. 748 * 749 * @return @c 1 (true) if an XML Namespace with the given uri/prefix pair is contained 750 * in this XMLNamespaces_t list, @c 0 (false) otherwise. 751 * 752 * @memberof XMLNamespaces_t 753 */ 754 LIBLAX_EXTERN 755 int 756 XMLNamespaces_hasNS(const XMLNamespaces_t *ns, const char* uri, const char* prefix); 757 758 759 END_C_DECLS 760 LIBSBML_CPP_NAMESPACE_END 761 762 #endif /* !SWIG */ 763 #endif /* XMLNamespaces_h */ 764