Xalan-C++ API Reference  1.12.0
XalanElement.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(XALANELEMENT_HEADER_GUARD_1357924680)
19 #define XALANELEMENT_HEADER_GUARD_1357924680
20 
21 
22 
25 
26 
27 
28 namespace XALAN_CPP_NAMESPACE {
29 
30 
31 
32 class XalanAttr;
33 
34 
35 
36 /*
37  * <meta name="usage" content="experimental"/>
38  *
39  * Base class for the DOM Element interface.
40  *
41  * This class is experimental and subject to change!!
42  */
43 
45 {
46 public:
47 
48  XalanElement();
49 
50  virtual
51  ~XalanElement();
52 
53  // These interfaces are inherited from XalanNode
54  virtual const XalanDOMString&
55  getNodeName() const = 0;
56 
57  /**
58  * Gets the value of this node, depending on its type.
59  */
60  virtual const XalanDOMString&
61  getNodeValue() const = 0;
62 
63  /**
64  * An enum value representing the type of the underlying object.
65  */
66  virtual NodeType
67  getNodeType() const = 0;
68 
69  /**
70  * Gets the parent of this node.
71  *
72  * All nodes, except <code>Document</code>,
73  * <code>DocumentFragment</code>, and <code>Attr</code> may have a parent.
74  * However, if a node has just been created and not yet added to the tree,
75  * or if it has been removed from the tree, a <code>null</code> Node
76  * is returned.
77  */
78  virtual XalanNode*
79  getParentNode() const = 0;
80 
81  /**
82  * Gets a <code>NodeList</code> that contains all children of this node.
83  *
84  * If there are no children, this is a <code>NodeList</code> containing no nodes.
85  */
86  virtual const XalanNodeList*
87  getChildNodes() const = 0;
88 
89  /**
90  * Gets the first child of this node.
91  *
92  * If there is no such node, this returns <code>null</code>.
93  */
94  virtual XalanNode*
95  getFirstChild() const = 0;
96 
97  /**
98  * Gets the last child of this node.
99  *
100  * If there is no such node, this returns <code>null</code>.
101  */
102  virtual XalanNode*
103  getLastChild() const = 0;
104 
105  /**
106  * Gets the node immediately preceding this node.
107  *
108  * If there is no such node, this returns <code>null</code>.
109  */
110  virtual XalanNode*
111  getPreviousSibling() const = 0;
112 
113  /**
114  * Gets the node immediately following this node.
115  *
116  * If there is no such node, this returns <code>null</code>.
117  */
118  virtual XalanNode*
119  getNextSibling() const = 0;
120 
121  /**
122  * Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
123  * is an <code>Element</code>) or <code>null</code> otherwise.
124  */
125  virtual const XalanNamedNodeMap*
126  getAttributes() const = 0;
127 
128  /**
129  * Gets the <code>Document</code> object associated with this node.
130  *
131  * This is also
132  * the <code>Document</code> object used to create new nodes. When this
133  * node is a <code>Document</code> or a <code>DocumentType</code>
134  * which is not used with any <code>Document</code> yet, this is
135  * <code>null</code>.
136  */
137  virtual XalanDocument*
138  getOwnerDocument() const = 0;
139 
140  /**
141  * Get the <em>namespace URI</em> of
142  * this node, or <code>null</code> if it is unspecified.
143  * <p>
144  * This is not a computed value that is the result of a namespace lookup
145  * based on an examination of the namespace declarations in scope. It is
146  * merely the namespace URI given at creation time.
147  * <p>
148  * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
149  * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
150  * such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
151  * interface, this is always <CODE>null</CODE>.
152  */
153  virtual const XalanDOMString&
154  getNamespaceURI() const = 0;
155 
156  /**
157  * Get the <em>namespace prefix</em>
158  * of this node, or <code>null</code> if it is unspecified.
159  */
160  virtual const XalanDOMString&
161  getPrefix() const = 0;
162 
163  /**
164  * Returns the local part of the <em>qualified name</em> of this node.
165  * <p>
166  * For nodes created with a DOM Level 1 method, such as
167  * <code>createElement</code> from the <code>Document</code> interface,
168  * it is null.
169  */
170  virtual const XalanDOMString&
171  getLocalName() const = 0;
172 
173  /**
174  * Determine if the document is node-order indexed.
175  *
176  * @return true if the document is indexed, otherwise false.
177  */
178  virtual bool
179  isIndexed() const = 0;
180 
181  /**
182  * Get the node's index. Valid only if the owner document
183  * reports that the document is node-order indexed.
184  *
185  * @return The index value, or 0 if the node is not indexed.
186  */
187  virtual IndexType
188  getIndex() const = 0;
189 
190  // These interfaces are new to XalanElement...
191 
192  /**
193  * The name of the element.
194  *
195  * For example, in: &lt;elementExample
196  * id="demo"&gt; ... &lt;/elementExample&gt; , <code>tagName</code> has
197  * the value <code>"elementExample"</code>. Note that this is
198  * case-preserving in XML, as are all of the operations of the DOM.
199  */
200  virtual const XalanDOMString&
201  getTagName() const = 0;
202 
203 protected:
204 
205  XalanElement(const XalanElement& theSource);
206 
207  XalanElement&
208  operator=(const XalanElement& theSource);
209 
210  bool
211  operator==(const XalanElement& theRHS) const;
212 
213 private:
214 };
215 
216 
217 
218 }
219 
220 
221 
222 #endif // !defined(XALANELEMENT_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