Xalan-C++ API Reference  1.12.0
XalanDocument.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XALANDOCUMENT_HEADER_GUARD_1357924680)
19 #define XALANDOCUMENT_HEADER_GUARD_1357924680
20 
21 
22 
25 
26 
27 
28 namespace XALAN_CPP_NAMESPACE {
29 
30 
31 
32 class XalanElement;
33 
34 
35 
37 {
38 public:
39 
40  XalanDocument();
41 
42  virtual
43  ~XalanDocument();
44 
45  // These interfaces are inherited from XalanNode...
46 
47  virtual const XalanDOMString&
48  getNodeName() const = 0;
49 
50  /**
51  * Gets the value of this node, depending on its type.
52  */
53  virtual const XalanDOMString&
54  getNodeValue() const = 0;
55 
56  /**
57  * An enum value representing the type of the underlying object.
58  */
59  virtual NodeType
60  getNodeType() const = 0;
61 
62  /**
63  * Gets the parent of this node.
64  *
65  * All nodes, except <code>Document</code>,
66  * <code>DocumentFragment</code>, and <code>Attr</code> may have a parent.
67  * However, if a node has just been created and not yet added to the tree,
68  * or if it has been removed from the tree, a <code>null</code> Node
69  * is returned.
70  */
71  virtual XalanNode*
72  getParentNode() const = 0;
73 
74  /**
75  * Gets a <code>NodeList</code> that contains all children of this node.
76  *
77  * If there are no children, this is a <code>NodeList</code> containing no nodes.
78  */
79  virtual const XalanNodeList*
80  getChildNodes() const = 0;
81 
82  /**
83  * Gets the first child of this node.
84  *
85  * If there is no such node, this returns <code>null</code>.
86  */
87  virtual XalanNode*
88  getFirstChild() const = 0;
89 
90  /**
91  * Gets the last child of this node.
92  *
93  * If there is no such node, this returns <code>null</code>.
94  */
95  virtual XalanNode*
96  getLastChild() const = 0;
97 
98  /**
99  * Gets the node immediately preceding this node.
100  *
101  * If there is no such node, this returns <code>null</code>.
102  */
103  virtual XalanNode*
104  getPreviousSibling() const = 0;
105 
106  /**
107  * Gets the node immediately following this node.
108  *
109  * If there is no such node, this returns <code>null</code>.
110  */
111  virtual XalanNode*
112  getNextSibling() const = 0;
113 
114  /**
115  * Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
116  * is an <code>Element</code>) or <code>null</code> otherwise.
117  */
118  virtual const XalanNamedNodeMap*
119  getAttributes() const = 0;
120 
121  /**
122  * Gets the <code>Document</code> object associated with this node.
123  *
124  * This is also
125  * the <code>Document</code> object used to create new nodes. When this
126  * node is a <code>Document</code> or a <code>DocumentType</code>
127  * which is not used with any <code>Document</code> yet, this is
128  * <code>null</code>.
129  */
130  virtual XalanDocument*
131  getOwnerDocument() const = 0;
132 
133  /**
134  * Get the <em>namespace URI</em> of
135  * this node, or <code>null</code> if it is unspecified.
136  * <p>
137  * This is not a computed value that is the result of a namespace lookup
138  * based on an examination of the namespace declarations in scope. It is
139  * merely the namespace URI given at creation time.
140  * <p>
141  * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
142  * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
143  * such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
144  * interface, this is always <CODE>null</CODE>.
145  */
146  virtual const XalanDOMString&
147  getNamespaceURI() const = 0;
148 
149  /**
150  * Get the <em>namespace prefix</em>
151  * of this node, or <code>null</code> if it is unspecified.
152  */
153  virtual const XalanDOMString&
154  getPrefix() const = 0;
155 
156  /**
157  * Returns the local part of the <em>qualified name</em> of this node.
158  * <p>
159  * For nodes created with a DOM Level 1 method, such as
160  * <code>createElement</code> from the <code>Document</code> interface,
161  * it is null.
162  */
163  virtual const XalanDOMString&
164  getLocalName() const = 0;
165 
166  /**
167  * Determine if the document is node-order indexed.
168  *
169  * @return true if the document is indexed, otherwise false.
170  */
171  virtual bool
172  isIndexed() const = 0;
173 
174  /**
175  * Get the node's index. Valid only if isIndexed()
176  * reports that the document is node-order indexed.
177  *
178  * @return The index value, or 0 if the node is not indexed.
179  */
180  virtual IndexType
181  getIndex() const = 0;
182 
183  // These interfaces are new to XalanDocument...
184 
185  /**
186  * Return a reference to the root element of the document.
187  */
188  virtual XalanElement*
189  getDocumentElement() const = 0;
190 
191  /**
192  * Returns the <code>Element</code> whose ID is given by <code>elementId</code>.
193  * If no such element exists, returns <code>null</code>.
194  * Behavior is not defined if more than one element has this <code>ID</code>.
195  * <P><B>Note:</B> The DOM implementation must have information that says
196  * which attributes are of type ID. Attributes with the name "ID" are not of
197  * type ID unless so defined. Implementations that do not know whether
198  * attributes are of type ID or not are expected to return
199  * <CODE>null</CODE>.</P>
200  *
201  * @param elementId The unique <code>id</code> value for an element.
202  * @return The matching element.
203  */
204  virtual XalanElement*
205  getElementById(const XalanDOMString& elementId) const = 0;
206 
207 protected:
208 
209  XalanDocument(const XalanDocument& theSource);
210 
212  operator=(const XalanDocument& theSource);
213 
214  bool
215  operator==(const XalanDocument& theRHS) const;
216 
217 private:
218 };
219 
220 
221 
222 }
223 
224 
225 
226 #endif // !defined(XALANDOCUMENT_HEADER_GUARD_1357924680)
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XalanNode
Definition: XalanNode.hpp:38
xalanc::XalanNode::NodeType
NodeType
Definition: XalanNode.hpp:47
xalanc::XalanDocument
Definition: XalanDocument.hpp:36
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
xalanc::XalanNode::IndexType
unsigned long IndexType
Definition: XalanNode.hpp:64
XalanNode.hpp
xalanc::XalanNodeList
Definition: XalanNodeList.hpp:36
xalanc::XalanElement
Definition: XalanElement.hpp:44
xalanc::XalanNamedNodeMap
Definition: XalanNamedNodeMap.hpp:36
XalanDOMDefinitions.hpp
XALAN_DOM_EXPORT
#define XALAN_DOM_EXPORT
Definition: XalanDOMDefinitions.hpp:37
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45