Xalan-C++ API Reference  1.12.0
XercesNamedNodeMapBridge.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(XERCESNAMEDNODEMAPBRIDGE_HEADER_GUARD_1357924680)
19 #define XERCESNAMEDNODEMAPBRIDGE_HEADER_GUARD_1357924680
20 
21 
22 
24 
25 
26 
27 #if XERCES_VERSION_MAJOR >= 2
28 #include <xercesc/dom/deprecated/DOM_NamedNodeMap.hpp>
29 #else
30 #include <xercesc/dom/DOM_NamedNodeMap.hpp>
31 #endif
32 
33 
34 
36 
37 
38 
39 namespace XALAN_CPP_NAMESPACE {
40 
41 
42 
43 class XercesBridgeNavigator;
44 class XercesNodeBridge;
45 
46 
47 /**
48  * This class is deprecated.
49  *
50  * @deprecated This class is part of the deprecated Xerces DOM bridge.
51  */
53 {
54 public:
55 
56  typedef xercesc::DOM_NamedNodeMap DOM_NamedNodeMapType;
57 
59  const DOM_NamedNodeMapType& theXercesNamedNodeMap,
60  const XercesBridgeNavigator& theNavigator);
61 
62  virtual
64 
65  /** @name Set functions. */
66  //@{
67 
68  /**
69  * Adds a node using its <code>nodeName</code> attribute.
70  *
71  * <br>As the <code>nodeName</code> attribute is used to derive the name
72  * which the node must be stored under, multiple nodes of certain types
73  * (those that have a "special" string value) cannot be stored as the names
74  * would clash. This is seen as preferable to allowing nodes to be aliased.
75  * @param arg A node to store in a named node map. The node will later be
76  * accessible using the value of the <code>nodeName</code> attribute of
77  * the node. If a node with that name is already present in the map, it
78  * is replaced by the new one.
79  * @return If the new <code>Node</code> replaces an existing node the
80  * replaced <code>Node</code> is returned,
81  * otherwise <code>null</code> is returned.
82  * @exception DOMException
83  * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
84  * different document than the one that created the
85  * <code>NamedNodeMap</code>.
86  * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
87  * <code>NamedNodeMap</code> is readonly.
88  * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
89  * <code>Attr</code> that is already an attribute of another
90  * <code>Element</code> object. The DOM user must explicitly clone
91  * <code>Attr</code> nodes to re-use them in other elements.
92  */
93  virtual XalanNode*
94  setNamedItem(XalanNode* arg);
95 
96  /**
97  * Returns the <code>index</code>th item in the map.
98  *
99  * If <code>index</code>
100  * is greater than or equal to the number of nodes in the map, this returns
101  * <code>null</code>.
102  * @param index Index into the map.
103  * @return The node at the <code>index</code>th position in the
104  * <code>NamedNodeMap</code>, or <code>null</code> if that is not a valid
105  * index.
106  */
107  virtual XalanNode*
108  item(unsigned int index) const;
109 
110  //@}
111  /** @name Get functions. */
112  //@{
113 
114  /**
115  * Retrieves a node specified by name.
116  *
117  * @param name The <code>nodeName</code> of a node to retrieve.
118  * @return A <code>DOM_Node</code> (of any type) with the specified <code>nodeName</code>, or
119  * <code>null</code> if it does not identify any node in
120  * the map.
121  */
122  virtual XalanNode*
123  getNamedItem(const XalanDOMString& name) const;
124 
125  /**
126  * The number of nodes in the map.
127  *
128  * The range of valid child node indices is
129  * 0 to <code>length-1</code> inclusive.
130  */
131  virtual unsigned int
132  getLength() const;
133 
134  //@}
135  /** @name Functions to change the node collection. */
136  //@{
137 
138  /**
139  * Removes a node specified by name.
140  *
141  * If the removed node is an
142  * <code>Attr</code> with a default value it is immediately replaced.
143  * @param name The <code>nodeName</code> of a node to remove.
144  * @return The node removed from the map or <code>null</code> if no node
145  * with such a name exists.
146  * @exception DOMException
147  * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
148  * the map.
149  * <br>
150  * NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>NamedNodeMap</code>
151  * is readonly.
152  */
153  virtual XalanNode*
154  removeNamedItem(const XalanDOMString& name);
155 
156  //@}
157  /** @name Functions introduced in DOM Level 2. */
158  //@{
159 
160  /**
161  * Retrieves a node specified by local name and namespace URI.
162  *
163  * @param namespaceURI The <em>namespace URI</em> of
164  * the node to retrieve.
165  * @param localName The <em>local name</em> of the node to retrieve.
166  * @return A <code>DOM_Node</code> (of any type) with the specified
167  * local name and namespace URI, or <code>null</code> if they do not
168  * identify any node in the map.
169  */
170  virtual XalanNode*
171  getNamedItemNS(
172  const XalanDOMString& namespaceURI,
173  const XalanDOMString& localName) const;
174 
175  /**
176  * Adds a node using its <CODE>namespaceURI</CODE> and <CODE>localName</CODE>.
177  * @param arg A node to store in a named node map. The node will later be
178  * accessible using the value of the <CODE>namespaceURI</CODE> and
179  * <CODE>localName</CODE> attribute of the node. If a node with those
180  * namespace URI and local name is already present in the map, it is
181  * replaced by the new one.
182  * @return If the new <code>Node</code> replaces an existing node the
183  * replaced <code>Node</code> is returned,
184  * otherwise <code>null</code> is returned.
185  * @exception DOMException
186  * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
187  * different document than the one that created the
188  * <code>NamedNodeMap</code>.
189  * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
190  * <code>NamedNodeMap</code> is readonly.
191  * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
192  * <code>Attr</code> that is already an attribute of another
193  * <code>Element</code> object. The DOM user must explicitly clone
194  * <code>Attr</code> nodes to re-use them in other elements.
195  */
196  virtual XalanNode*
197  setNamedItemNS(XalanNode* arg);
198 
199  /**
200  * Removes a node specified by local name and namespace URI.
201  *
202  * @param namespaceURI The <em>namespace URI</em> of
203  * the node to remove.
204  * @param localName The <em>local name</em> of the
205  * node to remove. When this <code>DOM_NamedNodeMap</code> contains the
206  * attributes attached to an element, as returned by the attributes
207  * attribute of the <code>DOM_Node</code> interface, if the removed
208  * attribute is known to have a default value, an attribute
209  * immediately appears containing the default value
210  * as well as the corresponding namespace URI, local name, and prefix.
211  * @return The node removed from the map if a node with such a local name
212  * and namespace URI exists.
213  * @exception DOMException
214  * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
215  * the map.
216  * <br>
217  * NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>NamedNodeMap</code>
218  * is readonly.
219  */
220  virtual XalanNode*
221  removeNamedItemNS(
222  const XalanDOMString& namespaceURI,
223  const XalanDOMString& localName);
224 
225  //@}
226 
227 private:
228 
229  // Not implemented...
231 
233  operator=(const XercesNamedNodeMapBridge& theRHS);
234 
235  bool
236  operator==(const XercesNamedNodeMapBridge& theRHS) const;
237 
238 
239  // $$$ ToDo: Eventually, this will not need to be mutable.
240  mutable DOM_NamedNodeMapType m_xercesNamedNodeMap;
241 
242  const XercesBridgeNavigator& m_navigator;
243 };
244 
245 
246 
247 }
248 
249 
250 
251 #endif // !defined(XERCESNAMEDNODEMAPBRIDGE_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::XercesNamedNodeMapBridge::DOM_NamedNodeMapType
xercesc::DOM_NamedNodeMap DOM_NamedNodeMapType
Definition: XercesNamedNodeMapBridge.hpp:56
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
xalanc::XercesNamedNodeMapBridge
This class is deprecated.
Definition: XercesNamedNodeMapBridge.hpp:52
XercesParserLiaisonDefinitions.hpp
XALAN_XERCESPARSERLIAISON_EXPORT
#define XALAN_XERCESPARSERLIAISON_EXPORT
Definition: XercesParserLiaisonDefinitions.hpp:39
XalanNamedNodeMap.hpp
xalanc::XalanNamedNodeMap
Definition: XalanNamedNodeMap.hpp:36
xalanc::XercesBridgeNavigator
This class is deprecated.
Definition: XercesBridgeNavigator.hpp:55
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45