Xalan-C++ API Reference 1.12.0
XercesEntityBridge.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(XERCESENTITYBRIDGE_HEADER_GUARD_1357924680)
19#define XERCESENTITYBRIDGE_HEADER_GUARD_1357924680
20
21
22
24
25
26
27#if XERCES_VERSION_MAJOR >= 2
28#include <xercesc/dom/deprecated/DOM_Entity.hpp>
29#else
30#include <xercesc/dom/DOM_Entity.hpp>
31#endif
32
33
34
36
37
38
40
41
42
43namespace XALAN_CPP_NAMESPACE {
44
45
46
47class XercesBridgeNavigator;
48
49
50/**
51 * This class is deprecated.
52 *
53 * @deprecated This class is part of the deprecated Xerces DOM bridge.
54 */
56{
57public:
58
59 typedef xercesc::DOM_Entity DOM_EntityType;
60
64
65 virtual
67
68
69 // These interfaces are inherited from XalanNode...
70
71 virtual const XalanDOMString&
72 getNodeName() const;
73
74 /**
75 * Gets the value of this node, depending on its type.
76 */
77 virtual const XalanDOMString&
78 getNodeValue() const;
79
80 /**
81 * An enum value representing the type of the underlying object.
82 */
83 virtual NodeType
84 getNodeType() const;
85
86 /**
87 * Gets the parent of this node.
88 *
89 * All nodes, except <code>Document</code>,
90 * <code>DocumentFragment</code>, and <code>Attr</code> may have a parent.
91 * However, if a node has just been created and not yet added to the tree,
92 * or if it has been removed from the tree, a <code>null</code> DOM_Node
93 * is returned.
94 */
95 virtual XalanNode*
97
98 /**
99 * Gets a <code>NodeList</code> that contains all children of this node.
100 *
101 * If there
102 * are no children, this is a <code>NodeList</code> containing no nodes.
103 * The content of the returned <code>NodeList</code> is "live" in the sense
104 * that, for instance, changes to the children of the node object that
105 * it was created from are immediately reflected in the nodes returned by
106 * the <code>NodeList</code> accessors; it is not a static snapshot of the
107 * content of the node. This is true for every <code>NodeList</code>,
108 * including the ones returned by the <code>getElementsByTagName</code>
109 * method.
110 */
111 virtual const XalanNodeList*
113
114 /**
115 * Gets the first child of this node.
116 *
117 * If there is no such node, this returns <code>null</code>.
118 */
119 virtual XalanNode*
121
122 /**
123 * Gets the last child of this node.
124 *
125 * If there is no such node, this returns <code>null</code>.
126 */
127 virtual XalanNode*
129
130 /**
131 * Gets the node immediately preceding this node.
132 *
133 * If there is no such node, this returns <code>null</code>.
134 */
135 virtual XalanNode*
137
138 /**
139 * Gets the node immediately following this node.
140 *
141 * If there is no such node, this returns <code>null</code>.
142 */
143 virtual XalanNode*
145
146 /**
147 * Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
148 * is an <code>Element</code>) or <code>null</code> otherwise.
149 */
150 virtual const XalanNamedNodeMap*
152
153 /**
154 * Gets the <code>DOM_Document</code> object associated with this node.
155 *
156 * This is also
157 * the <code>DOM_Document</code> object used to create new nodes. When this
158 * node is a <code>DOM_Document</code> or a <code>DOM_DocumentType</code>
159 * which is not used with any <code>DOM_Document</code> yet, this is
160 * <code>null</code>.
161 */
162 virtual XalanDocument*
164
165 //@}
166 /** @name Cloning function. */
167 //@{
168
169 /**
170 * Returns a duplicate of this node.
171 *
172 * This function serves as a generic copy constructor for nodes.
173 *
174 * The duplicate node has no parent (
175 * <code>parentNode</code> returns <code>null</code>.).
176 * <br>Cloning an <code>Element</code> copies all attributes and their
177 * values, including those generated by the XML processor to represent
178 * defaulted attributes, but this method does not copy any text it contains
179 * unless it is a deep clone, since the text is contained in a child
180 * <code>Text</code> node. Cloning any other type of node simply returns a
181 * copy of this node.
182 * @param deep If <code>true</code>, recursively clone the subtree under the
183 * specified node; if <code>false</code>, clone only the node itself (and
184 * its attributes, if it is an <code>Element</code>).
185 * @return The duplicate node.
186 */
187 virtual XercesEntityBridge*
188 cloneNode(bool deep) const;
189
190 //@}
191 /** @name Functions to modify the DOM Node. */
192 //@{
193
194 /**
195 * Inserts the node <code>newChild</code> before the existing child node
196 * <code>refChild</code>.
197 *
198 * If <code>refChild</code> is <code>null</code>,
199 * insert <code>newChild</code> at the end of the list of children.
200 * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
201 * all of its children are inserted, in the same order, before
202 * <code>refChild</code>. If the <code>newChild</code> is already in the
203 * tree, it is first removed. Note that a <code>DOM_Node</code> that
204 * has never been assigned to refer to an actual node is == null.
205 * @param newChild The node to insert.
206 * @param refChild The reference node, i.e., the node before which the new
207 * node must be inserted.
208 * @return The node being inserted.
209 */
210 virtual XalanNode*
214
215 /**
216 * Replaces the child node <code>oldChild</code> with <code>newChild</code>
217 * in the list of children, and returns the <code>oldChild</code> node.
218 *
219 * If <CODE>newChild</CODE> is a <CODE>DOM_DocumentFragment</CODE> object,
220 * <CODE>oldChild</CODE> is replaced by all of the <CODE>DOM_DocumentFragment</CODE>
221 * children, which are inserted in the same order.
222 *
223 * If the <code>newChild</code> is already in the tree, it is first removed.
224 * @param newChild The new node to put in the child list.
225 * @param oldChild The node being replaced in the list.
226 * @return The node replaced.
227 */
228 virtual XalanNode*
232
233 /**
234 * Removes the child node indicated by <code>oldChild</code> from the list
235 * of children, and returns it.
236 *
237 * @param oldChild The node being removed.
238 * @return The node removed.
239 */
240 virtual XalanNode*
242
243 /**
244 * Adds the node <code>newChild</code> to the end of the list of children of
245 * this node.
246 *
247 * If the <code>newChild</code> is already in the tree, it is
248 * first removed.
249 * @param newChild The node to add.If it is a <code>DocumentFragment</code>
250 * object, the entire contents of the document fragment are moved into
251 * the child list of this node
252 * @return The node added.
253 */
254 virtual XalanNode*
256
257 //@}
258 /** @name Query functions. */
259 //@{
260
261 /**
262 * This is a convenience method to allow easy determination of whether a
263 * node has any children.
264 *
265 * @return <code>true</code> if the node has any children,
266 * <code>false</code> if the node has no children.
267 */
268 virtual bool
270
271
272 //@}
273 /** @name Set functions. */
274 //@{
275
276
277 /**
278 * Sets the value of the node.
279 *
280 * Any node which can have a nodeValue (@see getNodeValue) will
281 * also accept requests to set it to a string. The exact response to
282 * this varies from node to node -- Attribute, for example, stores
283 * its values in its children and has to replace them with a new Text
284 * holding the replacement value.
285 *
286 * For most types of Node, value is null and attempting to set it
287 * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
288 * also be thrown if the node is read-only.
289 */
290 virtual void
292
293 //@}
294 /** @name Functions introduced in DOM Level 2. */
295 //@{
296
297 /**
298 * Puts all <CODE>DOM_Text</CODE>
299 * nodes in the full depth of the sub-tree underneath this <CODE>DOM_Node</CODE>,
300 * including attribute nodes, into a "normal" form where only markup (e.g.,
301 * tags, comments, processing instructions, CDATA sections, and entity
302 * references) separates <CODE>DOM_Text</CODE>
303 * nodes, i.e., there are no adjacent <CODE>DOM_Text</CODE>
304 * nodes. This can be used to ensure that the DOM view of a document is the
305 * same as if it were saved and re-loaded, and is useful when operations
306 * (such as XPointer lookups) that depend on a particular document tree
307 * structure are to be used.
308 * <P><B>Note:</B> In cases where the document contains <CODE>DOM_CDATASections</CODE>,
309 * the normalize operation alone may not be sufficient, since XPointers do
310 * not differentiate between <CODE>DOM_Text</CODE>
311 * nodes and <CODE>DOM_CDATASection</CODE> nodes.</P>
312 */
313 virtual void
315
316 /**
317 * Tests whether the DOM implementation implements a specific
318 * feature and that feature is supported by this node.
319 * @param feature The string of the feature to test. This is the same
320 * name as what can be passed to the method <code>hasFeature</code> on
321 * <code>DOMImplementation</code>.
322 * @param version This is the version number of the feature to test. In
323 * Level 2, version 1, this is the string "2.0". If the version is not
324 * specified, supporting any version of the feature will cause the
325 * method to return <code>true</code>.
326 * @return Returns <code>true</code> if the specified feature is supported
327 * on this node, <code>false</code> otherwise.
328 */
329 virtual bool
331 const XalanDOMString& feature,
332 const XalanDOMString& version) const;
333
334 /**
335 * Get the <em>namespace URI</em> of
336 * this node, or <code>null</code> if it is unspecified.
337 * <p>
338 * This is not a computed value that is the result of a namespace lookup
339 * based on an examination of the namespace declarations in scope. It is
340 * merely the namespace URI given at creation time.
341 * <p>
342 * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
343 * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
344 * such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
345 * interface, this is always <CODE>null</CODE>.
346 */
347 virtual const XalanDOMString&
349
350 /**
351 * Get the <em>namespace prefix</em>
352 * of this node, or <code>null</code> if it is unspecified.
353 */
354 virtual const XalanDOMString&
355 getPrefix() const;
356
357 /**
358 * Returns the local part of the <em>qualified name</em> of this node.
359 * <p>
360 * For nodes created with a DOM Level 1 method, such as
361 * <code>createElement</code> from the <code>DOM_Document</code> interface,
362 * it is null.
363 */
364 virtual const XalanDOMString&
366
367 /**
368 * Set the <em>namespace prefix</em> of this node.
369 * <p>
370 * Note that setting this attribute, when permitted, changes
371 * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
372 * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
373 * attributes of the <CODE>DOM_Element</CODE> and <CODE>DOM_Attr</CODE>
374 * interfaces, when applicable.
375 * <p>
376 * Note also that changing the prefix of an
377 * attribute, that is known to have a default value, does not make a new
378 * attribute with the default value and the original prefix appear, since the
379 * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
380 *
381 * @param prefix The prefix of this node.
382 * @exception DOMException
383 * INVALID_CHARACTER_ERR: Raised if the specified prefix contains
384 * an illegal character.
385 * <br>
386 * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
387 * <br>
388 * NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
389 * malformed, if the specified prefix is "xml" and the
390 * <CODE>namespaceURI</CODE> of this node is different from
391 * "http://www.w3.org/XML/1998/namespace", if specified prefix is
392 * "xmlns" and the <CODE>namespaceURI</CODE> is neither
393 * <CODE>null</CODE> nor an empty string, or if the
394 * <CODE>localName</CODE> is <CODE>null</CODE>.
395 */
396 virtual void
398
399 virtual bool
400 isIndexed() const;
401
402 virtual IndexType
403 getIndex() const;
404
405 //@}
406
407 // These interfaces are inherited from XalanEntity...
408
409 /**
410 * Get the public identifier of this notation.
411 *
412 * If the public identifier was not
413 * specified, this is <code>null</code>.
414 * @return Returns the public identifier of the notation
415 */
416 virtual const XalanDOMString&
417 getPublicId() const;
418
419 /**
420 * Get the system identifier of this notation.
421 *
422 * If the system identifier was not
423 * specified, this is <code>null</code>.
424 * @return Returns the system identifier of the notation
425 */
426 virtual const XalanDOMString&
427 getSystemId() const;
428
429 /**
430 * For unparsed entities, the name of the notation for the entity.
431 *
432 * For parsed entities, this is <code>null</code>.
433 */
434 virtual const XalanDOMString&
436
437 /**
438 * Get the Xerces node this instance represent.
439 *
440 * @return The Xerces node
441 */
444 {
445 return m_xercesNode;
446 }
447
448private:
449
450 // Not implemented...
452
454 operator=(const XercesEntityBridge& theSource);
455
456 bool
458
459 // Data members...
460 // $$$ Note that there is an order dependency here,
461 // due do a code generation bug with MSVC 6.0. The
462 // call to construct the XercesNodeListBridge uses
463 // the m_xercesNode data member instead of the
464 // constructor parameter. I have no idea why MSVC
465 // generate bogus code when using the parameter, but
466 // it does...
467 DOM_EntityType m_xercesNode;
468
469 const XercesBridgeNavigator& m_navigator;
470
471 XercesNodeListBridge m_children;
472};
473
474
475
476}
477
478
479
480#endif // !defined(XERCESENTITYBRIDGE_HEADER_GUARD_1357924680)
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
#define XALAN_XERCESPARSERLIAISON_EXPORT
This class is deprecated.
virtual const XalanDOMString & getNodeValue() const
Gets the value of this node, depending on its type.
virtual IndexType getIndex() const
Get the node's index.
virtual XalanNode * getNextSibling() const
Gets the node immediately following this node.
virtual const XalanDOMString & getNodeName() const
Gets the name of this node, depending on its type.
virtual XalanNode * getLastChild() const
Gets the last child of this node.
virtual const XalanDOMString & getSystemId() const
Get the system identifier of this notation.
virtual bool isSupported(const XalanDOMString &feature, const XalanDOMString &version) const
Tests whether the DOM implementation implements a specific feature and that feature is supported by t...
virtual XalanNode * getPreviousSibling() const
Gets the node immediately preceding this node.
DOM_EntityType getXercesNode() const
Get the Xerces node this instance represent.
virtual const XalanDOMString & getPrefix() const
Get the namespace prefix of this node, or null if it is unspecified.
virtual XalanDocument * getOwnerDocument() const
Gets the DOM_Document object associated with this node.
virtual bool hasChildNodes() const
This is a convenience method to allow easy determination of whether a node has any children.
virtual const XalanDOMString & getNamespaceURI() const
Get the namespace URI of this node, or null if it is unspecified.
virtual void setNodeValue(const XalanDOMString &nodeValue)
Sets the value of the node.
virtual XalanNode * getFirstChild() const
Gets the first child of this node.
virtual const XalanDOMString & getNotationName() const
For unparsed entities, the name of the notation for the entity.
virtual void normalize()
Puts all DOM_Text nodes in the full depth of the sub-tree underneath this DOM_Node,...
virtual bool isIndexed() const
Determine if the document is node-order indexed.
virtual const XalanNodeList * getChildNodes() const
Gets a NodeList that contains all children of this node.
virtual void setPrefix(const XalanDOMString &prefix)
Set the namespace prefix of this node.
XercesEntityBridge(const DOM_EntityType &theXercesDOMEntity, const XercesBridgeNavigator &theNavigator)
xercesc::DOM_Entity DOM_EntityType
virtual const XalanNamedNodeMap * getAttributes() const
Gets a NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
virtual const XalanDOMString & getLocalName() const
Returns the local part of the qualified name of this node.
virtual NodeType getNodeType() const
An enum value representing the type of the underlying object.
virtual XalanNode * appendChild(XalanNode *newChild)
Adds the node newChild to the end of the list of children of this node.
virtual XalanNode * removeChild(XalanNode *oldChild)
Removes the child node indicated by oldChild from the list of children, and returns it.
virtual XalanNode * insertBefore(XalanNode *newChild, XalanNode *refChild)
Inserts the node newChild before the existing child node refChild.
virtual XalanNode * replaceChild(XalanNode *newChild, XalanNode *oldChild)
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node...
virtual XalanNode * getParentNode() const
Gets the parent of this node.
virtual const XalanDOMString & getPublicId() const
Get the public identifier of this notation.
virtual XercesEntityBridge * cloneNode(bool deep) const
Returns a duplicate of this node.
xercesc::DOM_Entity DOM_EntityType
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)