Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


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