Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


XercesCDATASectionBridge.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(XERCESCDATASECTIONBRIDGE_HEADER_GUARD_1357924680)
19 #define XERCESCDATASECTIONBRIDGE_HEADER_GUARD_1357924680
20 
21 
22 
24 
25 
26 
27 #if XERCES_VERSION_MAJOR >= 2
28 #include <xercesc/dom/deprecated/DOM_CDATASection.hpp>
29 #else
30 #include <xercesc/dom/DOM_CDATASection.hpp>
31 #endif
32 
33 
34 
36 
37 
38 
40 
41 
42 
43 XALAN_CPP_NAMESPACE_BEGIN
44 
45 
46 
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_CDATASectionType& theXercesCDATASection,
61  const XercesBridgeNavigator& theNavigator);
62 
63  virtual
65 
66 
67  /**
68  * Gets the name of this node.
69  */
70  virtual const XalanDOMString&
71  getNodeName() const;
72 
73  /**
74  * Gets the value of this node, depending on its type.
75  */
76  virtual const XalanDOMString&
77  getNodeValue() const;
78 
79  /**
80  * An enum value representing the type of the underlying object.
81  */
82  virtual NodeType
83  getNodeType() const;
84 
85  /**
86  * Gets the parent of this node.
87  *
88  * All nodes, except <code>Document</code>,
89  * <code>DocumentFragment</code>, and <code>Attr</code> may have a parent.
90  * However, if a node has just been created and not yet added to the tree,
91  * or if it has been removed from the tree, a <code>null</code> DOM_Node
92  * is returned.
93  */
94  virtual XalanNode*
95  getParentNode() const;
96 
97  /**
98  * Gets a <code>NodeList</code> that contains all children of this node.
99  *
100  * If there
101  * are no children, this is a <code>NodeList</code> containing no nodes.
102  * The content of the returned <code>NodeList</code> is "live" in the sense
103  * that, for instance, changes to the children of the node object that
104  * it was created from are immediately reflected in the nodes returned by
105  * the <code>NodeList</code> accessors; it is not a static snapshot of the
106  * content of the node. This is true for every <code>NodeList</code>,
107  * including the ones returned by the <code>getElementsByTagName</code>
108  * method.
109  */
110  virtual const XalanNodeList*
111  getChildNodes() const;
112 
113  /**
114  * Gets the first child of this node.
115  *
116  * If there is no such node, this returns <code>null</code>.
117  */
118  virtual XalanNode*
119  getFirstChild() const;
120 
121  /**
122  * Gets the last child of this node.
123  *
124  * If there is no such node, this returns <code>null</code>.
125  */
126  virtual XalanNode*
127  getLastChild() const;
128 
129  /**
130  * Gets the node immediately preceding this node.
131  *
132  * If there is no such node, this returns <code>null</code>.
133  */
134  virtual XalanNode*
135  getPreviousSibling() const;
136 
137  /**
138  * Gets the node immediately following this node.
139  *
140  * If there is no such node, this returns <code>null</code>.
141  */
142  virtual XalanNode*
143  getNextSibling() const;
144 
145  /**
146  * Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
147  * is an <code>Element</code>) or <code>null</code> otherwise.
148  */
149  virtual const XalanNamedNodeMap*
150  getAttributes() const;
151 
152  /**
153  * Gets the <code>DOM_Document</code> object associated with this node.
154  *
155  * This is also
156  * the <code>DOM_Document</code> object used to create new nodes. When this
157  * node is a <code>DOM_Document</code> or a <code>DOM_DocumentType</code>
158  * which is not used with any <code>DOM_Document</code> yet, this is
159  * <code>null</code>.
160  */
161  virtual XalanDocument*
162  getOwnerDocument() const;
163 
164  //@}
165  /** @name Cloning function. */
166  //@{
167 
168  /**
169  * Returns a duplicate of this node.
170  *
171  * This function serves as a generic copy constructor for nodes.
172  *
173  * The duplicate node has no parent (
174  * <code>parentNode</code> returns <code>null</code>.).
175  * <br>Cloning an <code>Element</code> copies all attributes and their
176  * values, including those generated by the XML processor to represent
177  * defaulted attributes, but this method does not copy any text it contains
178  * unless it is a deep clone, since the text is contained in a child
179  * <code>Text</code> node. Cloning any other type of node simply returns a
180  * copy of this node.
181  * @param deep If <code>true</code>, recursively clone the subtree under the
182  * specified node; if <code>false</code>, clone only the node itself (and
183  * its attributes, if it is an <code>Element</code>).
184  * @return The duplicate node.
185  */
186 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
187  virtual XalanNode*
188 #else
189  virtual XercesCDATASectionBridge*
190 #endif
191  cloneNode(bool deep) const;
192 
193  //@}
194  /** @name Functions to modify the DOM Node. */
195  //@{
196 
197  /**
198  * Inserts the node <code>newChild</code> before the existing child node
199  * <code>refChild</code>.
200  *
201  * If <code>refChild</code> is <code>null</code>,
202  * insert <code>newChild</code> at the end of the list of children.
203  * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
204  * all of its children are inserted, in the same order, before
205  * <code>refChild</code>. If the <code>newChild</code> is already in the
206  * tree, it is first removed. Note that a <code>DOM_Node</code> that
207  * has never been assigned to refer to an actual node is == null.
208  * @param newChild The node to insert.
209  * @param refChild The reference node, i.e., the node before which the new
210  * node must be inserted.
211  * @return The node being inserted.
212  */
213  virtual XalanNode*
214  insertBefore(
215  XalanNode* newChild,
216  XalanNode* refChild);
217 
218  /**
219  * Replaces the child node <code>oldChild</code> with <code>newChild</code>
220  * in the list of children, and returns the <code>oldChild</code> node.
221  *
222  * If <CODE>newChild</CODE> is a <CODE>DOM_DocumentFragment</CODE> object,
223  * <CODE>oldChild</CODE> is replaced by all of the <CODE>DOM_DocumentFragment</CODE>
224  * children, which are inserted in the same order.
225  *
226  * If the <code>newChild</code> is already in the tree, it is first removed.
227  * @param newChild The new node to put in the child list.
228  * @param oldChild The node being replaced in the list.
229  * @return The node replaced.
230  */
231  virtual XalanNode*
232  replaceChild(
233  XalanNode* newChild,
234  XalanNode* oldChild);
235 
236  /**
237  * Removes the child node indicated by <code>oldChild</code> from the list
238  * of children, and returns it.
239  *
240  * @param oldChild The node being removed.
241  * @return The node removed.
242  */
243  virtual XalanNode*
244  removeChild(XalanNode* oldChild);
245 
246  /**
247  * Adds the node <code>newChild</code> to the end of the list of children of
248  * this node.
249  *
250  * If the <code>newChild</code> is already in the tree, it is
251  * first removed.
252  * @param newChild The node to add.If it is a <code>DocumentFragment</code>
253  * object, the entire contents of the document fragment are moved into
254  * the child list of this node
255  * @return The node added.
256  */
257  virtual XalanNode*
258  appendChild(XalanNode* newChild);
259 
260  //@}
261  /** @name Query functions. */
262  //@{
263 
264  /**
265  * This is a convenience method to allow easy determination of whether a
266  * node has any children.
267  *
268  * @return <code>true</code> if the node has any children,
269  * <code>false</code> if the node has no children.
270  */
271  virtual bool
272  hasChildNodes() const;
273 
274 
275  //@}
276  /** @name Set functions. */
277  //@{
278 
279 
280  /**
281  * Sets the value of the node.
282  *
283  * Any node which can have a nodeValue (@see getNodeValue) will
284  * also accept requests to set it to a string. The exact response to
285  * this varies from node to node -- Attribute, for example, stores
286  * its values in its children and has to replace them with a new Text
287  * holding the replacement value.
288  *
289  * For most types of Node, value is null and attempting to set it
290  * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
291  * also be thrown if the node is read-only.
292  */
293  virtual void
294  setNodeValue(const XalanDOMString& nodeValue);
295 
296  //@}
297  /** @name Functions introduced in DOM Level 2. */
298  //@{
299 
300  /**
301  * Puts all <CODE>DOM_Text</CODE>
302  * nodes in the full depth of the sub-tree underneath this <CODE>DOM_Node</CODE>,
303  * including attribute nodes, into a "normal" form where only markup (e.g.,
304  * tags, comments, processing instructions, CDATA sections, and entity
305  * references) separates <CODE>DOM_Text</CODE>
306  * nodes, i.e., there are no adjacent <CODE>DOM_Text</CODE>
307  * nodes. This can be used to ensure that the DOM view of a document is the
308  * same as if it were saved and re-loaded, and is useful when operations
309  * (such as XPointer lookups) that depend on a particular document tree
310  * structure are to be used.
311  * <P><B>Note:</B> In cases where the document contains <CODE>DOM_CDATASections</CODE>,
312  * the normalize operation alone may not be sufficient, since XPointers do
313  * not differentiate between <CODE>DOM_Text</CODE>
314  * nodes and <CODE>DOM_CDATASection</CODE> nodes.</P>
315  */
316  virtual void
317  normalize();
318 
319  /**
320  * Tests whether the DOM implementation implements a specific
321  * feature and that feature is supported by this node.
322  * @param feature The string of the feature to test. This is the same
323  * name as what can be passed to the method <code>hasFeature</code> on
324  * <code>DOMImplementation</code>.
325  * @param version This is the version number of the feature to test. In
326  * Level 2, version 1, this is the string "2.0". If the version is not
327  * specified, supporting any version of the feature will cause the
328  * method to return <code>true</code>.
329  * @return Returns <code>true</code> if the specified feature is supported
330  * on this node, <code>false</code> otherwise.
331  */
332  virtual bool
333  isSupported(
334  const XalanDOMString& feature,
335  const XalanDOMString& version) const;
336 
337  /**
338  * Get the <em>namespace URI</em> of
339  * this node, or <code>null</code> if it is unspecified.
340  * <p>
341  * This is not a computed value that is the result of a namespace lookup
342  * based on an examination of the namespace declarations in scope. It is
343  * merely the namespace URI given at creation time.
344  * <p>
345  * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
346  * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
347  * such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
348  * interface, this is always <CODE>null</CODE>.
349  */
350  virtual const XalanDOMString&
351  getNamespaceURI() const;
352 
353  /**
354  * Get the <em>namespace prefix</em>
355  * of this node, or <code>null</code> if it is unspecified.
356  */
357  virtual const XalanDOMString&
358  getPrefix() const;
359 
360  /**
361  * Returns the local part of the <em>qualified name</em> of this node.
362  * <p>
363  * For nodes created with a DOM Level 1 method, such as
364  * <code>createElement</code> from the <code>DOM_Document</code> interface,
365  * it is null.
366  */
367  virtual const XalanDOMString&
368  getLocalName() const;
369 
370  /**
371  * Set the <em>namespace prefix</em> of this node.
372  * <p>
373  * Note that setting this attribute, when permitted, changes
374  * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
375  * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
376  * attributes of the <CODE>DOM_Element</CODE> and <CODE>DOM_Attr</CODE>
377  * interfaces, when applicable.
378  * <p>
379  * Note also that changing the prefix of an
380  * attribute, that is known to have a default value, does not make a new
381  * attribute with the default value and the original prefix appear, since the
382  * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
383  *
384  * @param prefix The prefix of this node.
385  * @exception DOMException
386  * INVALID_CHARACTER_ERR: Raised if the specified prefix contains
387  * an illegal character.
388  * <br>
389  * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
390  * <br>
391  * NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
392  * malformed, if the specified prefix is "xml" and the
393  * <CODE>namespaceURI</CODE> of this node is different from
394  * "http://www.w3.org/XML/1998/namespace", if specified prefix is
395  * "xmlns" and the <CODE>namespaceURI</CODE> is neither
396  * <CODE>null</CODE> nor an empty string, or if the
397  * <CODE>localName</CODE> is <CODE>null</CODE>.
398  */
399  virtual void
400  setPrefix(const XalanDOMString& prefix);
401 
402  virtual bool
403  isIndexed() const;
404 
405  virtual IndexType
406  getIndex() const;
407 
408  //@}
409 
410  // These interfaces are inherited from XalanCDATASection...
411 
412  /** @name Getter functions. */
413  //@{
414  /**
415  * Returns the character data of the node that implements this interface.
416  *
417  * The DOM implementation may not put arbitrary limits on the amount of data that
418  * may be stored in a <code>CharacterData</code> node. However,
419  * implementation limits may mean that the entirety of a node's data may
420  * not fit into a single <code>DOMString</code>. In such cases, the user
421  * may call <code>substringData</code> to retrieve the data in
422  * appropriately sized pieces.
423  * @exception DOMException
424  * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
425  * @exception DOMException
426  * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
427  * fit in a <code>DOMString</code> variable on the implementation
428  * platform.
429  */
430  virtual const XalanDOMString&
431  getData() const;
432 
433  /**
434  * Returns the number of characters that are available through <code>data</code> and
435  * the <code>substringData</code> method below.
436  *
437  * This may have the value
438  * zero, i.e., <code>CharacterData</code> nodes may be empty.
439  */
440  virtual unsigned int
441  getLength() const;
442 
443  /**
444  * Extracts a range of data from the node.
445  *
446  * @param offset Start offset of substring to extract.
447  * @param count The number of characters to extract.
448  * @return The specified substring. If the sum of <code>offset</code> and
449  * <code>count</code> exceeds the <code>length</code>, then all
450  * characters to the end of the data are returned.
451  * @exception DOMException
452  * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
453  * than the number of characters in <code>data</code>, or if the
454  * specified <code>count</code> is negative.
455  * <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not
456  * fit into a <code>DOMString</code>.
457  */
458  virtual XalanDOMString
459  substringData(
460  unsigned int offset,
461  unsigned int count) const;
462 
463  //@}
464  /** @name Functions that set or change data. */
465  //@{
466  /**
467  * Append the string to the end of the character data of the node.
468  *
469  * Upon success, <code>data</code> provides access to the concatenation of
470  * <code>data</code> and the <code>DOMString</code> specified.
471  * @param arg The <code>DOMString</code> to append.
472  * @exception DOMException
473  * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
474  */
475  virtual void
476  appendData(const XalanDOMString& arg);
477 
478  /**
479  * Insert a string at the specified character offset.
480  *
481  * @param offset The character offset at which to insert.
482  * @param arg The <code>DOMString</code> to insert.
483  * @exception DOMException
484  * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
485  * than the number of characters in <code>data</code>.
486  * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
487  */
488  virtual void
489  insertData(
490  unsigned int offset,
491  const XalanDOMString& arg);
492 
493  /**
494  * Remove a range of characters from the node.
495  *
496  * Upon success,
497  * <code>data</code> and <code>length</code> reflect the change.
498  * @param offset The offset from which to remove characters.
499  * @param count The number of characters to delete. If the sum of
500  * <code>offset</code> and <code>count</code> exceeds <code>length</code>
501  * then all characters from <code>offset</code> to the end of the data
502  * are deleted.
503  * @exception DOMException
504  * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
505  * than the number of characters in <code>data</code>, or if the
506  * specified <code>count</code> is negative.
507  * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
508  */
509  virtual void
510  deleteData(
511  unsigned int offset,
512  unsigned int count);
513 
514  /**
515  * Replace the characters starting at the specified character offset with
516  * the specified string.
517  *
518  * @param offset The offset from which to start replacing.
519  * @param count The number of characters to replace. If the sum of
520  * <code>offset</code> and <code>count</code> exceeds <code>length</code>
521  * , then all characters to the end of the data are replaced (i.e., the
522  * effect is the same as a <code>remove</code> method call with the same
523  * range, followed by an <code>append</code> method invocation).
524  * @param arg The <code>DOMString</code> with which the range must be
525  * replaced.
526  * @exception DOMException
527  * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
528  * than the number of characters in <code>data</code>, or if the
529  * specified <code>count</code> is negative.
530  * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
531  */
532  virtual void
533  replaceData(
534  unsigned int offset,
535  unsigned int count,
536  const XalanDOMString& arg);
537 
538  //@}
539 
540  //@}
541  /** @name Functions to modify the Text node. */
542  //@{
543 
544  /**
545  * Breaks this node into two nodes at the specified
546  * offset, keeping both in the tree as siblings.
547  *
548  * This node then only
549  * contains all the content up to the <code>offset</code> point. And a new
550  * node of the same nodeType, which is inserted as the next sibling of this
551  * node, contains all the content at and after the <code>offset</code>
552  * point. When the <code>offset</code> is equal to the lenght of this node,
553  * the new node has no data.
554  * @param offset The offset at which to split, starting from 0.
555  * @return The new <code>Text</code> node.
556  * @exception DOMException
557  * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
558  * than the number of characters in <code>data</code>.
559  * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
560  */
561  virtual XalanText*
562  splitText(unsigned int offset);
563 
564  //@}
565 
566  virtual bool
567  isWhitespace() const;
568 
569  /**
570  * Get the Xerces node this instance represent.
571  *
572  * @return The Xerces node
573  */
576  {
577  return m_xercesNode;
578  }
579 
580 private:
581 
582  // Not implemented...
584 
586  operator=(const XercesCDATASectionBridge& theSource);
587 
588  bool
589  operator==(const XercesCDATASectionBridge& theRHS) const;
590 
591  // Data members...
592  DOM_CDATASectionType m_xercesNode;
593 
594  const XercesBridgeNavigator& m_navigator;
595 };
596 
597 
598 
599 XALAN_CPP_NAMESPACE_END
600 
601 
602 
603 #endif // !defined(XERCESCDATASECTIONBRIDGE_HEADER_GUARD_1357924680)
DOM_CDATASectionType getXercesNode() const
Get the Xerces node this instance represent.
virtual const XalanDOMString & getNodeValue() const =0
Gets the value of this node, depending on its type.
virtual const XalanNamedNodeMap * getAttributes() const =0
Gets a NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise...
virtual XalanNode * getFirstChild() const =0
Gets the first child of this node.
#define XALAN_XERCESPARSERLIAISON_EXPORT
XERCES_CPP_NAMESPACE_QUALIFIER DOM_CDATASection DOM_CDATASectionType
virtual const XalanDOMString & getData() const =0
Returns the character data of the node that implements this interface.
virtual const XalanNodeList * getChildNodes() const =0
Gets a NodeList that contains all children of this node.
virtual const XalanDOMString & getLocalName() const =0
Returns the local part of the qualified name of this node.
This class is deprecated.
virtual XalanDocument * getOwnerDocument() const =0
Gets the Document object associated with this node.
virtual XalanNode * getParentNode() const =0
Gets the parent of this node.
virtual XalanNode * getPreviousSibling() const =0
Gets the node immediately preceding this node.
virtual XalanNode * getLastChild() const =0
Gets the last child of this node.
virtual bool isIndexed() const =0
Determine if the document is node-order indexed.
virtual NodeType getNodeType() const =0
An enum value representing the type of the underlying object.
virtual const XalanDOMString & getNodeName() const =0
Gets the name of this node, depending on its type.
virtual const XalanDOMString & getPrefix() const =0
Get the namespace prefix of this node, or null if it is unspecified.
unsigned long IndexType
Definition: XalanNode.hpp:64
virtual IndexType getIndex() const =0
Get the node&#39;s index.
virtual const XalanDOMString & getNamespaceURI() const =0
Get the namespace URI of this node, or null if it is unspecified.
This class is deprecated.
virtual bool isWhitespace() const =0
Determine whether the text node instance is composed entirely of XML whitespace.
bool operator==(const XalanCDATASection &theRHS) const
XalanCDATASection & operator=(const XalanCDATASection &theSource)
virtual XalanNode * getNextSibling() const =0
Gets the node immediately following this node.

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.11
Copyright © 1999-2012 The Apache Software Foundation.
All Rights Reserved.

Apache Logo