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