/usr/include/xercesc/dom/DOMNode.hpp is in libxerces-c2-dev 2.8.0+deb1-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | #ifndef DOMNode_HEADER_GUARD_
#define DOMNode_HEADER_GUARD_
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: DOMNode.hpp 568078 2007-08-21 11:43:25Z amassari $
*/
#include <xercesc/util/XercesDefs.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class DOMDocument;
class DOMNamedNodeMap;
class DOMNodeList;
class DOMUserDataHandler;
/**
* The <code>DOMNode</code> interface is the primary datatype for the entire
* Document Object Model. It represents a single node in the document tree.
* While all objects implementing the <code>DOMNode</code> interface expose
* methods for dealing with children, not all objects implementing the
* <code>DOMNode</code> interface may have children. For example,
* <code>DOMText</code> nodes may not have children, and adding children to
* such nodes results in a <code>DOMException</code> being raised.
* <p>The attributes <code>nodeName</code>, <code>nodeValue</code> and
* <code>attributes</code> are included as a mechanism to get at node
* information without casting down to the specific derived interface. In
* cases where there is no obvious mapping of these attributes for a
* specific <code>nodeType</code> (e.g., <code>nodeValue</code> for an
* <code>DOMElement</code> or <code>attributes</code> for a <code>DOMComment</code>
* ), this returns <code>null</code>. Note that the specialized interfaces
* may contain additional and more convenient mechanisms to get and set the
* relevant information.
* <p>The values of <code>nodeName</code>,
* <code>nodeValue</code>, and <code>attributes</code> vary according to the
* node type as follows:
* <table border='1'>
* <tr>
* <td>Interface</td>
* <td>nodeName</td>
* <td>nodeValue</td>
* <td>attributes</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMAttr</td>
* <td valign='top' rowspan='1' colspan='1'>name of attribute</td>
* <td valign='top' rowspan='1' colspan='1'>value of attribute</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMCDATASection</td>
* <td valign='top' rowspan='1' colspan='1'>"#cdata-section"</td>
* <td valign='top' rowspan='1' colspan='1'>content of the CDATA Section</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMComment</td>
* <td valign='top' rowspan='1' colspan='1'>"#comment"</td>
* <td valign='top' rowspan='1' colspan='1'>content of the comment</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMDocument</td>
* <td valign='top' rowspan='1' colspan='1'>"#document"</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMDocumentFragment</td>
* <td valign='top' rowspan='1' colspan='1'>"#document-fragment"</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMDocumentType</td>
* <td valign='top' rowspan='1' colspan='1'>document type name</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMElement</td>
* <td valign='top' rowspan='1' colspan='1'>tag name</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* <td valign='top' rowspan='1' colspan='1'>NamedNodeMap</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMEntity</td>
* <td valign='top' rowspan='1' colspan='1'>entity name</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMEntityReference</td>
* <td valign='top' rowspan='1' colspan='1'>name of entity referenced</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMNotation</td>
* <td valign='top' rowspan='1' colspan='1'>notation name</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMProcessingInstruction</td>
* <td valign='top' rowspan='1' colspan='1'>target</td>
* <td valign='top' rowspan='1' colspan='1'>entire content excluding the target</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOMText</td>
* <td valign='top' rowspan='1' colspan='1'>"#text"</td>
* <td valign='top' rowspan='1' colspan='1'>content of the text node</td>
* <td valign='top' rowspan='1' colspan='1'>null</td>
* </tr>
* </table>
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
*
* @since DOM Level 1
*/
class CDOM_EXPORT DOMNode {
protected:
// -----------------------------------------------------------------------
// Hidden constructors
// -----------------------------------------------------------------------
/** @name Hidden constructors */
//@{
DOMNode() {}
DOMNode(const DOMNode &) {}
//@}
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
/** @name Unimplemented operators */
//@{
DOMNode & operator = (const DOMNode &);
//@}
public:
// -----------------------------------------------------------------------
// All constructors are hidden, just the destructor is available
// -----------------------------------------------------------------------
/** @name Destructor */
//@{
/**
* Destructor
*
*/
virtual ~DOMNode() {};
//@}
// -----------------------------------------------------------------------
// Class Types
// -----------------------------------------------------------------------
/** @name Public Contants */
//@{
/**
* NodeType
*
* @since DOM Level 1
*/
enum NodeType {
ELEMENT_NODE = 1,
ATTRIBUTE_NODE = 2,
TEXT_NODE = 3,
CDATA_SECTION_NODE = 4,
ENTITY_REFERENCE_NODE = 5,
ENTITY_NODE = 6,
PROCESSING_INSTRUCTION_NODE = 7,
COMMENT_NODE = 8,
DOCUMENT_NODE = 9,
DOCUMENT_TYPE_NODE = 10,
DOCUMENT_FRAGMENT_NODE = 11,
NOTATION_NODE = 12
};
/**
* TreePosition:
*
* <p><b>"Experimental - subject to change"</b></p>
*
* <p><code>TREE_POSITION_PRECEDING:</code>
* The node precedes the reference node.</p>
* <p><code>TREE_POSITION_FOLLOWING:</code>
* The node follows the reference node.</p>
* <p><code>TREE_POSITION_ANCESTOR:</code>
* The node is an ancestor of the reference node.</p>
* <p><code>TREE_POSITION_DESCENDANT:</code>
* The node is a descendant of the reference node.</p>
* <p><code>TREE_POSITION_EQUIVALENT:</code>
* The two nodes have an equivalent position. This is the case of two
* attributes that have the same <code>ownerElement</code>, and two
* nodes that are the same.</p>
* <p><code>TREE_POSITION_SAME_NODE:</code>
* The two nodes are the same. Two nodes that are the same have an
* equivalent position, though the reverse may not be true.</p>
* <p><code>TREE_POSITION_DISCONNECTED:</code>
* The two nodes are disconnected, they do not have any common ancestor.
* This is the case of two nodes that are not in the same document.</p>
*
* @since DOM Level 3
*/
enum DOMTreePosition {
TREE_POSITION_PRECEDING = 0x01,
TREE_POSITION_FOLLOWING = 0x02,
TREE_POSITION_ANCESTOR = 0x04,
TREE_POSITION_DESCENDANT = 0x08,
TREE_POSITION_EQUIVALENT = 0x10,
TREE_POSITION_SAME_NODE = 0x20,
TREE_POSITION_DISCONNECTED = 0x00
};
//@}
// -----------------------------------------------------------------------
// Virtual DOMNode interface
// -----------------------------------------------------------------------
/** @name Functions introduced in DOM Level 1 */
//@{
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
/**
* The name of this node, depending on its type; see the table above.
* @since DOM Level 1
*/
virtual const XMLCh * getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
* @since DOM Level 1
*/
virtual const XMLCh * getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
* @since DOM Level 1
*/
virtual short getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>DOMDocument</code>,
* <code>DOMDocumentFragment</code>, and <code>DOMAttr</code> may have a parent.
* However, if a node has just been created and not yet added to the tree,
* or if it has been removed from the tree, a <code>null</code> DOMNode
* is returned.
* @since DOM Level 1
*/
virtual DOMNode *getParentNode() const = 0;
/**
* Gets a <code>DOMNodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>DOMNodeList</code> containing no nodes.
* The content of the returned <code>DOMNodeList</code> is "live" in the sense
* that, for instance, changes to the children of the node object that
* it was created from are immediately reflected in the nodes returned by
* the <code>DOMNodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>DOMNodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
* @since DOM Level 1
*/
virtual DOMNodeList *getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
* @since DOM Level 1
*/
virtual DOMNode *getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
* @since DOM Level 1
*/
virtual DOMNode *getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
* @since DOM Level 1
*/
virtual DOMNode *getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
* @since DOM Level 1
*/
virtual DOMNode *getNextSibling() const = 0;
/**
* Gets a <code>DOMNamedNodeMap</code> containing the attributes of this node (if it
* is an <code>DOMElement</code>) or <code>null</code> otherwise.
* @since DOM Level 1
*/
virtual DOMNamedNodeMap *getAttributes() const = 0;
/**
* Gets the <code>DOMDocument</code> object associated with this node.
*
* This is also
* the <code>DOMDocument</code> object used to create new nodes. When this
* node is a <code>DOMDocument</code> or a <code>DOMDocumentType</code>
* which is not used with any <code>DOMDocument</code> yet, this is
* <code>null</code>.
*
* @since DOM Level 1
*/
virtual DOMDocument *getOwnerDocument() const = 0;
// -----------------------------------------------------------------------
// Node methods
// -----------------------------------------------------------------------
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>DOMElement</code> copies all attributes and their
* values, including those generated by the XML processor to represent
* defaulted attributes, but this method does not copy any text it contains
* unless it is a deep clone, since the text is contained in a child
* <code>DOMText</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>DOMElement</code>).
* @return The duplicate node.
* @since DOM Level 1
*/
virtual DOMNode * cloneNode(bool deep) const = 0;
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DOMDocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>DOMNode</code> that
* has never been assigned to refer to an actual node is == null.
* @param newChild The node to insert.
* @param refChild The reference node, i.e., the node before which the new
* node must be inserted.
* @return The node being inserted.
* @exception DOMException
* HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
* allow children of the type of the <code>newChild</code> node, or if
* the node to insert is one of this node's ancestors.
* <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
* from a different document than the one that created this node.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being
* inserted is readonly.
* <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of
* this node.
* @since DOM Level 1
*/
virtual DOMNode *insertBefore(DOMNode *newChild,
DOMNode *refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DOMDocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DOMDocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> is already in the tree, it is first removed.
* @param newChild The new node to put in the child list.
* @param oldChild The node being replaced in the list.
* @return The node replaced.
* @exception DOMException
* HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
* allow children of the type of the <code>newChild</code> node, or it
* the node to put in is one of this node's ancestors.
* <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
* from a different document than the one that created this node.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the new node is readonly.
* <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
* this node.
* @since DOM Level 1
*/
virtual DOMNode *replaceChild(DOMNode *newChild,
DOMNode *oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
* this node.
* @since DOM Level 1
*/
virtual DOMNode *removeChild(DOMNode *oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DOMDocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
* @exception DOMException
* HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
* allow children of the type of the <code>newChild</code> node, or if
* the node to append is one of this node's ancestors.
* <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
* from a different document than the one that created this node.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being
* appended is readonly.
* @since DOM Level 1
*/
virtual DOMNode *appendChild(DOMNode *newChild) = 0;
// -----------------------------------------------------------------------
// Query methods
// -----------------------------------------------------------------------
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
* @since DOM Level 1
*/
virtual bool hasChildNodes() const = 0;
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue will
* also accept requests to set it to a string. The exact response to
* this varies from node to node -- Attribute, for example, stores
* its values in its children and has to replace them with a new Text
* holding the replacement value.
*
* For most types of Node, value is null and attempting to set it
* will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
* also be thrown if the node is read-only.
* @see #getNodeValue
* @since DOM Level 1
*/
virtual void setNodeValue(const XMLCh *nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>DOMText</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>DOMNode</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>DOMText</CODE>
* nodes, i.e., there are neither adjacent <CODE>DOMText</CODE>
* nodes nor empty <CODE>DOMText</CODE>
* nodes. This can be used to ensure that the DOM view of a document is the
* same as if it were saved and re-loaded, and is useful when operations
* (such as XPointer lookups) that depend on a particular document tree
* structure are to be used.
* <P><B>Note:</B> In cases where the document contains <CODE>DOMCDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>DOMText</CODE>
* nodes and <CODE>DOMCDATASection</CODE>
* nodes.</P>
*
* @since DOM Level 2
*/
virtual void normalize() = 0;
/**
* Tests whether the DOM implementation implements a specific
* feature and that feature is supported by this node.
*
* @param feature The string of the feature to test. This is the same
* name as what can be passed to the method <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @param version This is the version number of the feature to test. In
* Level 2, version 1, this is the string "2.0". If the version is not
* specified, supporting any version of the feature will cause the
* method to return <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
* @since DOM Level 2
*/
virtual bool isSupported(const XMLCh *feature,
const XMLCh *version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* This is not a computed value that is the result of a namespace lookup
* based on an examination of the namespace declarations in scope. It is
* merely the namespace URI given at creation time.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>DOMDocument</CODE>
* interface, this is always <CODE>null</CODE>.
*
* @since DOM Level 2
*/
virtual const XMLCh * getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*
* @since DOM Level 2
*/
virtual const XMLCh * getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>DOMDocument</code> interface,
* it is null.
*
* @since DOM Level 2
*/
virtual const XMLCh * getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>DOMElement</CODE> and <CODE>DOMAttr</CODE>
* interfaces, when applicable.
* <p>
* Note also that changing the prefix of an
* attribute, that is known to have a default value, does not make a new
* attribute with the default value and the original prefix appear, since the
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the <CODE>namespaceURI</CODE> of this node is
* <CODE>null</CODE>, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if this node is an attribute
* and the specified prefix is "xmlns" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/2000/xmlns/", or if this node is an attribute and
* the <CODE>qualifiedName</CODE> of this node is "xmlns".
* @since DOM Level 2
*/
virtual void setPrefix(const XMLCh * prefix) = 0;
/**
* Returns whether this node (if it is an element) has any attributes.
* @return <code>true</code> if this node has any attributes,
* <code>false</code> otherwise.
* @since DOM Level 2
*/
virtual bool hasAttributes() const = 0;
//@}
/** @name Functions introduced in DOM Level 3. */
//@{
/**
* Returns whether this node is the same node as the given one.
* <br>This method provides a way to determine whether two
* <code>DOMNode</code> references returned by the implementation reference
* the same object. When two <code>DOMNode</code> references are references
* to the same object, even if through a proxy, the references may be
* used completely interchangeably, such that all attributes have the
* same values and calling the same DOM method on either reference
* always has exactly the same effect.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param other The node to test against.
* @return Returns <code>true</code> if the nodes are the same,
* <code>false</code> otherwise.
* @since DOM Level 3
*/
virtual bool isSameNode(const DOMNode* other) const = 0;
/**
* Tests whether two nodes are equal.
* <br>This method tests for equality of nodes, not sameness (i.e.,
* whether the two nodes are pointers to the same object) which can be
* tested with <code>DOMNode::isSameNode</code>. All nodes that are the same
* will also be equal, though the reverse may not be true.
* <br>Two nodes are equal if and only if the following conditions are
* satisfied: The two nodes are of the same type.The following string
* attributes are equal: <code>nodeName</code>, <code>localName</code>,
* <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
* , <code>baseURI</code>. This is: they are both <code>null</code>, or
* they have the same length and are character for character identical.
* The <code>attributes</code> <code>DOMNamedNodeMaps</code> are equal.
* This is: they are both <code>null</code>, or they have the same
* length and for each node that exists in one map there is a node that
* exists in the other map and is equal, although not necessarily at the
* same index.The <code>childNodes</code> <code>DOMNodeLists</code> are
* equal. This is: they are both <code>null</code>, or they have the
* same length and contain equal nodes at the same index. This is true
* for <code>DOMAttr</code> nodes as for any other type of node. Note that
* normalization can affect equality; to avoid this, nodes should be
* normalized before being compared.
* <br>For two <code>DOMDocumentType</code> nodes to be equal, the following
* conditions must also be satisfied: The following string attributes
* are equal: <code>publicId</code>, <code>systemId</code>,
* <code>internalSubset</code>.The <code>entities</code>
* <code>DOMNamedNodeMaps</code> are equal.The <code>notations</code>
* <code>DOMNamedNodeMaps</code> are equal.
* <br>On the other hand, the following do not affect equality: the
* <code>ownerDocument</code> attribute, the <code>specified</code>
* attribute for <code>DOMAttr</code> nodes, the
* <code>isWhitespaceInElementContent</code> attribute for
* <code>DOMText</code> nodes, as well as any user data or event listeners
* registered on the nodes.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param arg The node to compare equality with.
* @return If the nodes, and possibly subtrees are equal,
* <code>true</code> otherwise <code>false</code>.
* @since DOM Level 3
*/
virtual bool isEqualNode(const DOMNode* arg) const = 0;
/**
* Associate an object to a key on this node. The object can later be
* retrieved from this node by calling <code>getUserData</code> with the
* same key.
*
* Deletion of the user data remains the responsibility of the
* application program; it will not be automatically deleted when
* the nodes themselves are reclaimed.
*
* Both the parameter <code>data</code> and the returned object are
* void pointer, it is applications' responsibility to keep track of
* their original type. Casting them to the wrong type may result
* unexpected behavior.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param key The key to associate the object to.
* @param data The object to associate to the given key, or
* <code>null</code> to remove any existing association to that key.
* @param handler The handler to associate to that key, or
* <code>null</code>.
* @return Returns the void* object previously associated to
* the given key on this node, or <code>null</code> if there was none.
* @see #getUserData
*
* @since DOM Level 3
*/
virtual void* setUserData(const XMLCh* key,
void* data,
DOMUserDataHandler* handler) = 0;
/**
* Retrieves the object associated to a key on a this node. The object
* must first have been set to this node by calling
* <code>setUserData</code> with the same key.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param key The key the object is associated to.
* @return Returns the <code>void*</code> associated to the given key
* on this node, or <code>null</code> if there was none.
* @see #setUserData
* @since DOM Level 3
*/
virtual void* getUserData(const XMLCh* key) const = 0;
/**
* The absolute base URI of this node or <code>null</code> if undefined.
* This value is computed according to . However, when the
* <code>DOMDocument</code> supports the feature "HTML" , the base URI is
* computed using first the value of the href attribute of the HTML BASE
* element if any, and the value of the <code>documentURI</code>
* attribute from the <code>DOMDocument</code> interface otherwise.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* <br> When the node is an <code>DOMElement</code>, a <code>DOMDocument</code>
* or a a <code>DOMProcessingInstruction</code>, this attribute represents
* the properties [base URI] defined in . When the node is a
* <code>DOMNotation</code>, an <code>DOMEntity</code>, or an
* <code>DOMEntityReference</code>, this attribute represents the
* properties [declaration base URI].
* @since DOM Level 3
*/
virtual const XMLCh* getBaseURI() const = 0;
/**
* Compares a node with this node with regard to their position in the
* tree and according to the document order. This order can be extended
* by module that define additional types of nodes.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param other The node to compare against this node.
* @return Returns how the given node is positioned relatively to this
* node.
* @since DOM Level 3
*/
virtual short compareTreePosition(const DOMNode* other) const = 0;
/**
* This attribute returns the text content of this node and its
* descendants. No serialization is performed, the returned string
* does not contain any markup. No whitespace normalization is
* performed and the returned string does not contain the white
* spaces in element content.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* <br>The string returned is made of the text content of this node
* depending on its type, as defined below:
* <table border='1'>
* <tr>
* <td>Node type</td>
* <td>Content</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>
* ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
* DOCUMENT_FRAGMENT_NODE</td>
* <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
* attribute value of every child node, excluding COMMENT_NODE and
* PROCESSING_INSTRUCTION_NODE nodes</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
* CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
* <td valign='top' rowspan='1' colspan='1'>
* <code>nodeValue</code></td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
* <td valign='top' rowspan='1' colspan='1'>
* null</td>
* </tr>
* </table>
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
* fit in a <code>DOMString</code> variable on the implementation
* platform.
* @see #setTextContext
* @since DOM Level 3
*/
virtual const XMLCh* getTextContent() const = 0;
/**
* This attribute removes any possible children this node may have and, if the
* new string is not empty or null, replaced by a single <code>DOMText</code>
* node containing the string this attribute is set to. No parsing is
* performed, the input string is taken as pure textual content.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
* @see #getTextContext
* @since DOM Level 3
*/
virtual void setTextContent(const XMLCh* textContent) = 0;
/**
* Look up the prefix associated to the given namespace URI, starting from
* this node.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param namespaceURI The namespace URI to look for.
* @param useDefault Indicates if the lookup mechanism should take into
* account the default namespace or not.
* @return Returns an associated namespace prefix if found,
* <code>null</code> if none is found and <code>useDefault</code> is
* false, or <code>null</code> if not found or it is the default
* namespace and <code>useDefault</code> is <code>true</code>. If more
* than one prefix are associated to the namespace prefix, the
* returned namespace prefix is implementation dependent.
* @since DOM Level 3
*/
virtual const XMLCh* lookupNamespacePrefix(const XMLCh* namespaceURI,
bool useDefault) const = 0;
/**
* This method checks if the specified <code>namespaceURI</code> is the
* default namespace or not.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param namespaceURI The namespace URI to look for.
* @return <code>true</code> if the specified <code>namespaceURI</code>
* is the default namespace, <code>false</code> otherwise.
* @since DOM Level 3
*/
virtual bool isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
/**
* Look up the namespace URI associated to the given prefix, starting from
* this node.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param prefix The prefix to look for. If this parameter is
* <code>null</code>, the method will return the default namespace URI
* if any.
* @return Returns the associated namespace URI or <code>null</code> if
* none is found.
* @since DOM Level 3
*/
virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const = 0;
/**
* This method makes available a <code>DOMNode</code>'s specialized interface
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param feature The name of the feature requested (case-insensitive).
* @return Returns an alternate <code>DOMNode</code> which implements the
* specialized APIs of the specified feature, if any, or
* <code>null</code> if there is no alternate <code>DOMNode</code> which
* implements interfaces associated with that feature. Any alternate
* <code>DOMNode</code> returned by this method must delegate to the
* primary core <code>DOMNode</code> and not return results inconsistent
* with the primary core <code>DOMNode</code> such as <code>key</code>,
* <code>attributes</code>, <code>childNodes</code>, etc.
* @since DOM Level 3
*/
virtual DOMNode* getInterface(const XMLCh* feature) = 0;
//@}
// -----------------------------------------------------------------------
// Non-standard Extension
// -----------------------------------------------------------------------
/** @name Non-standard Extension */
//@{
/**
* Called to indicate that this Node (and its associated children) is no longer in use
* and that the implementation may relinquish any resources associated with it and
* its associated children.
*
* If this is a document, any nodes it owns (created by DOMDocument::createXXXX())
* are also released.
*
* Access to a released object will lead to unexpected result.
*
* @exception DOMException
* INVALID_ACCESS_ERR: Raised if this Node has a parent and thus should not be released yet.
*/
virtual void release() = 0;
//@}
#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
// -----------------------------------------------------------------------
// Non-standard Extension
// -----------------------------------------------------------------------
/** @name Non-standard Extension */
//@{
/**
* This is custom function which can be implemented by classes deriving
* from DOMNode for implementing reference counting on DOMNodes. Any
* implementation which has memory management model which involves
* disposing of nodes immediately after being used can override this
* function to do that job.
*/
virtual void decRefCount() {}
//@}
// -----------------------------------------------------------------------
// Non-standard Extension
// -----------------------------------------------------------------------
/** @name Non-standard Extension */
//@{
/**
* This is custom function which can be implemented by classes deriving
* from DOMNode for implementing reference counting on DOMNodes.
*/
virtual void incRefCount() {}
//@}
#endif
};
/***
* Utilities macros for getting memory manager within DOM
***/
#define GET_OWNER_DOCUMENT(ptr) \
((DOMDocumentImpl*)(ptr->getOwnerDocument()))
#define GET_DIRECT_MM(ptr) \
ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager
#define GET_INDIRECT_MM(ptr) \
!ptr ? XMLPlatformUtils::fgMemoryManager : \
GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \
XMLPlatformUtils::fgMemoryManager
/***
* For DOMNode and its derivatives
***/
#define GetDOMNodeMemoryManager GET_INDIRECT_MM(this)
XERCES_CPP_NAMESPACE_END
#endif
|