source: icXML/icXML-devel/src/xercesc/dom/DOMText.hpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

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