source: NonGTP/Xerces/xerces/include/xercesc/dom/DOMText.hpp @ 358

Revision 358, 7.8 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1#ifndef DOMText_HEADER_GUARD_
2#define DOMText_HEADER_GUARD_
3
4/*
5 * Copyright 2001-2002,2004 The Apache Software Foundation.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20/*
21 * $Id: DOMText.hpp,v 1.10 2004/09/26 15:38:02 gareth Exp $
22 */
23
24#include <xercesc/util/XercesDefs.hpp>
25#include <xercesc/dom/DOMCharacterData.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29
30/**
31 * The <code>DOMText</code> interface inherits from <code>DOMCharacterData</code>
32 * and represents the textual content (termed character data in XML) of an
33 * <code>DOMElement</code> or <code>DOMAttr</code>. If there is no markup inside
34 * an element's content, the text is contained in a single object
35 * implementing the <code>DOMText</code> interface that is the only child of
36 * the element. If there is markup, it is parsed into the information items
37 * (elements, comments, etc.) and <code>DOMText</code> nodes that form the list
38 * of children of the element.
39 * <p>When a document is first made available via the DOM, there is only one
40 * <code>DOMText</code> node for each block of text. Users may create adjacent
41 * <code>DOMText</code> nodes that represent the contents of a given element
42 * without any intervening markup, but should be aware that there is no way
43 * to represent the separations between these nodes in XML or HTML, so they
44 * will not (in general) persist between DOM editing sessions. The
45 * <code>normalize()</code> method on <code>DOMNode</code> merges any such
46 * adjacent <code>DOMText</code> objects into a single node for each block of
47 * text.
48 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
49 */
50class CDOM_EXPORT DOMText: public DOMCharacterData {
51protected:
52    // -----------------------------------------------------------------------
53    //  Hidden constructors
54    // -----------------------------------------------------------------------
55    /** @name Hidden constructors */
56    //@{   
57    DOMText() {};
58    //@}
59
60private:
61    // -----------------------------------------------------------------------
62    // Unimplemented constructors and operators
63    // -----------------------------------------------------------------------
64    /** @name Unimplemented constructors and operators */
65    //@{
66    DOMText(const DOMText &);
67    DOMText & operator = (const DOMText &);
68    //@}
69
70public:
71    // -----------------------------------------------------------------------
72    //  All constructors are hidden, just the destructor is available
73    // -----------------------------------------------------------------------
74    /** @name Destructor */
75    //@{
76    /**
77     * Destructor
78     *
79     */
80    virtual ~DOMText() {};
81    //@}
82
83    // -----------------------------------------------------------------------
84    //  Virtual DOMText interface
85    // -----------------------------------------------------------------------
86    /** @name Functions introduced in DOM Level 1 */
87    //@{
88    /**
89     * Breaks this node into two nodes at the specified <code>offset</code>,
90     * keeping both in the tree as siblings. After being split, this node
91     * will contain all the content up to the <code>offset</code> point. A
92     * new node of the same type, which contains all the content at and
93     * after the <code>offset</code> point, is returned. If the original
94     * node had a parent node, the new node is inserted as the next sibling
95     * of the original node. When the <code>offset</code> is equal to the
96     * length of this node, the new node has no data.
97     * @param offset The 16-bit unit offset at which to split, starting from
98     *   <code>0</code>.
99     * @return The new node, of the same type as this node.
100     * @exception DOMException
101     *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
102     *   than the number of 16-bit units in <code>data</code>.
103     *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
104     * @since DOM Level 1
105     */
106    virtual DOMText *splitText(XMLSize_t offset) = 0;
107    //@}
108
109    /** @name Functions introduced in DOM Level 3 */
110    //@{
111    /**
112     * Returns whether this text node contains whitespace in element content,
113     * often abusively called "ignorable whitespace".  An implementation can
114     * only return <code>true</code> if, one way or another, it has access
115     * to the relevant information (e.g., the DTD or schema).
116     *
117     * <p><b>"Experimental - subject to change"</b></p>
118     *
119     * <br> This attribute represents the property [element content
120     * whitespace] defined in .
121     * @since DOM Level 3
122     */
123    virtual bool     getIsWhitespaceInElementContent() const = 0;
124
125    /**
126     * Returns all text of <code>DOMText</code> nodes logically-adjacent text
127     * nodes to this node, concatenated in document order.
128     *
129     * <p><b>"Experimental - subject to change"</b></p>
130     *
131     * @since DOM Level 3
132     */
133    virtual const XMLCh* getWholeText() = 0;
134
135    /**
136     * Substitutes the a specified text for the text of the current node and
137     * all logically-adjacent text nodes.
138     *
139     * <p><b>"Experimental - subject to change"</b></p>
140     *
141     * <br>This method returns the node in the hierarchy which received the
142     * replacement text, which is null if the text was empty or is the
143     * current node if the current node is not read-only or otherwise is a
144     * new node of the same type as the current node inserted at the site of
145     * the replacement. All logically-adjacent text nodes are removed
146     * including the current node unless it was the recipient of the
147     * replacement text.
148     * <br>Where the nodes to be removed are read-only descendants of an
149     * <code>DOMEntityReference</code>, the <code>DOMEntityReference</code> must
150     * be removed instead of the read-only nodes. If any
151     * <code>DOMEntityReference</code> to be removed has descendants that are
152     * not <code>DOMEntityReference</code>, <code>DOMText</code>, or
153     * <code>DOMCDATASection</code> nodes, the <code>replaceWholeText</code>
154     * method must fail before performing any modification of the document,
155     * raising a <code>DOMException</code> with the code
156     * <code>NO_MODIFICATION_ALLOWED_ERR</code>.
157     * @param content The content of the replacing <code>DOMText</code> node.
158     * @return The <code>DOMText</code> node created with the specified content.
159     * @exception DOMException
160     *   NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>DOMText</code>
161     *   nodes being replaced is readonly.
162     * @since DOM Level 3
163     */
164    virtual DOMText* replaceWholeText(const XMLCh* content) = 0;
165    //@}
166
167    // -----------------------------------------------------------------------
168    // Non-standard extension
169    // -----------------------------------------------------------------------
170    /** @name Non-standard extension */
171    //@{
172    /**
173     * Non-standard extension
174     *
175     * Return true if this node contains ignorable whitespaces only.
176     * @return True if this node contains ignorable whitespaces only.
177     */
178    virtual bool isIgnorableWhitespace() const = 0;
179    //@}
180
181};
182
183
184XERCES_CPP_NAMESPACE_END
185
186#endif
187
188
Note: See TracBrowser for help on using the repository browser.