[188] | 1 | #ifndef DOMText_HEADER_GUARD_
|
---|
| 2 | #define DOMText_HEADER_GUARD_
|
---|
| 3 |
|
---|
| 4 | /*
|
---|
| 5 | * The Apache Software License, Version 1.1
|
---|
| 6 | *
|
---|
| 7 | * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
|
---|
| 8 | * reserved.
|
---|
| 9 | *
|
---|
| 10 | * Redistribution and use in source and binary forms, with or without
|
---|
| 11 | * modification, are permitted provided that the following conditions
|
---|
| 12 | * are met:
|
---|
| 13 | *
|
---|
| 14 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer.
|
---|
| 16 | *
|
---|
| 17 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 18 | * notice, this list of conditions and the following disclaimer in
|
---|
| 19 | * the documentation and/or other materials provided with the
|
---|
| 20 | * distribution.
|
---|
| 21 | *
|
---|
| 22 | * 3. The end-user documentation included with the redistribution,
|
---|
| 23 | * if any, must include the following acknowledgment:
|
---|
| 24 | * "This product includes software developed by the
|
---|
| 25 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 26 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 27 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 28 | *
|
---|
| 29 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 30 | * not be used to endorse or promote products derived from this
|
---|
| 31 | * software without prior written permission. For written
|
---|
| 32 | * permission, please contact apache\@apache.org.
|
---|
| 33 | *
|
---|
| 34 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 35 | * nor may "Apache" appear in their name, without prior written
|
---|
| 36 | * permission of the Apache Software Foundation.
|
---|
| 37 | *
|
---|
| 38 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 39 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 40 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 41 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 42 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 43 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 44 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 45 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 46 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 47 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 48 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 49 | * SUCH DAMAGE.
|
---|
| 50 | * ====================================================================
|
---|
| 51 | *
|
---|
| 52 | * This software consists of voluntary contributions made by many
|
---|
| 53 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 54 | * originally based on software copyright (c) 2001, International
|
---|
| 55 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 56 | * on the Apache Software Foundation, please see
|
---|
| 57 | * <http://www.apache.org/>.
|
---|
| 58 | */
|
---|
| 59 |
|
---|
| 60 | /*
|
---|
| 61 | * $Id: DOMText.hpp,v 1.8 2003/03/07 19:59:09 tng Exp $
|
---|
| 62 | */
|
---|
| 63 |
|
---|
| 64 | #include <xercesc/util/XercesDefs.hpp>
|
---|
| 65 | #include "DOMCharacterData.hpp"
|
---|
| 66 |
|
---|
| 67 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 68 |
|
---|
| 69 |
|
---|
| 70 | /**
|
---|
| 71 | * The <code>DOMText</code> interface inherits from <code>DOMCharacterData</code>
|
---|
| 72 | * and represents the textual content (termed character data in XML) of an
|
---|
| 73 | * <code>DOMElement</code> or <code>DOMAttr</code>. If there is no markup inside
|
---|
| 74 | * an element's content, the text is contained in a single object
|
---|
| 75 | * implementing the <code>DOMText</code> interface that is the only child of
|
---|
| 76 | * the element. If there is markup, it is parsed into the information items
|
---|
| 77 | * (elements, comments, etc.) and <code>DOMText</code> nodes that form the list
|
---|
| 78 | * of children of the element.
|
---|
| 79 | * <p>When a document is first made available via the DOM, there is only one
|
---|
| 80 | * <code>DOMText</code> node for each block of text. Users may create adjacent
|
---|
| 81 | * <code>DOMText</code> nodes that represent the contents of a given element
|
---|
| 82 | * without any intervening markup, but should be aware that there is no way
|
---|
| 83 | * to represent the separations between these nodes in XML or HTML, so they
|
---|
| 84 | * will not (in general) persist between DOM editing sessions. The
|
---|
| 85 | * <code>normalize()</code> method on <code>DOMNode</code> merges any such
|
---|
| 86 | * adjacent <code>DOMText</code> objects into a single node for each block of
|
---|
| 87 | * text.
|
---|
| 88 | * <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>.
|
---|
| 89 | */
|
---|
| 90 | class CDOM_EXPORT DOMText: public DOMCharacterData {
|
---|
| 91 | protected:
|
---|
| 92 | // -----------------------------------------------------------------------
|
---|
| 93 | // Hidden constructors
|
---|
| 94 | // -----------------------------------------------------------------------
|
---|
| 95 | /** @name Hidden constructors */
|
---|
| 96 | //@{
|
---|
| 97 | DOMText() {};
|
---|
| 98 | //@}
|
---|
| 99 |
|
---|
| 100 | private:
|
---|
| 101 | // -----------------------------------------------------------------------
|
---|
| 102 | // Unimplemented constructors and operators
|
---|
| 103 | // -----------------------------------------------------------------------
|
---|
| 104 | /** @name Unimplemented constructors and operators */
|
---|
| 105 | //@{
|
---|
| 106 | DOMText(const DOMText &);
|
---|
| 107 | DOMText & operator = (const DOMText &);
|
---|
| 108 | //@}
|
---|
| 109 |
|
---|
| 110 | public:
|
---|
| 111 | // -----------------------------------------------------------------------
|
---|
| 112 | // All constructors are hidden, just the destructor is available
|
---|
| 113 | // -----------------------------------------------------------------------
|
---|
| 114 | /** @name Destructor */
|
---|
| 115 | //@{
|
---|
| 116 | /**
|
---|
| 117 | * Destructor
|
---|
| 118 | *
|
---|
| 119 | */
|
---|
| 120 | virtual ~DOMText() {};
|
---|
| 121 | //@}
|
---|
| 122 |
|
---|
| 123 | // -----------------------------------------------------------------------
|
---|
| 124 | // Virtual DOMText interface
|
---|
| 125 | // -----------------------------------------------------------------------
|
---|
| 126 | /** @name Functions introduced in DOM Level 1 */
|
---|
| 127 | //@{
|
---|
| 128 | /**
|
---|
| 129 | * Breaks this node into two nodes at the specified <code>offset</code>,
|
---|
| 130 | * keeping both in the tree as siblings. After being split, this node
|
---|
| 131 | * will contain all the content up to the <code>offset</code> point. A
|
---|
| 132 | * new node of the same type, which contains all the content at and
|
---|
| 133 | * after the <code>offset</code> point, is returned. If the original
|
---|
| 134 | * node had a parent node, the new node is inserted as the next sibling
|
---|
| 135 | * of the original node. When the <code>offset</code> is equal to the
|
---|
| 136 | * length of this node, the new node has no data.
|
---|
| 137 | * @param offset The 16-bit unit offset at which to split, starting from
|
---|
| 138 | * <code>0</code>.
|
---|
| 139 | * @return The new node, of the same type as this node.
|
---|
| 140 | * @exception DOMException
|
---|
| 141 | * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
|
---|
| 142 | * than the number of 16-bit units in <code>data</code>.
|
---|
| 143 | * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
---|
| 144 | * @since DOM Level 1
|
---|
| 145 | */
|
---|
| 146 | virtual DOMText *splitText(XMLSize_t offset) = 0;
|
---|
| 147 | //@}
|
---|
| 148 |
|
---|
| 149 | /** @name Functions introduced in DOM Level 3 */
|
---|
| 150 | //@{
|
---|
| 151 | /**
|
---|
| 152 | * Returns whether this text node contains whitespace in element content,
|
---|
| 153 | * often abusively called "ignorable whitespace". An implementation can
|
---|
| 154 | * only return <code>true</code> if, one way or another, it has access
|
---|
| 155 | * to the relevant information (e.g., the DTD or schema).
|
---|
| 156 | *
|
---|
| 157 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 158 | *
|
---|
| 159 | * <br> This attribute represents the property [element content
|
---|
| 160 | * whitespace] defined in .
|
---|
| 161 | * @since DOM Level 3
|
---|
| 162 | */
|
---|
| 163 | virtual bool getIsWhitespaceInElementContent() const = 0;
|
---|
| 164 |
|
---|
| 165 | /**
|
---|
| 166 | * Returns all text of <code>DOMText</code> nodes logically-adjacent text
|
---|
| 167 | * nodes to this node, concatenated in document order.
|
---|
| 168 | *
|
---|
| 169 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 170 | *
|
---|
| 171 | * @since DOM Level 3
|
---|
| 172 | */
|
---|
| 173 | virtual const XMLCh* getWholeText() = 0;
|
---|
| 174 |
|
---|
| 175 | /**
|
---|
| 176 | * Substitutes the a specified text for the text of the current node and
|
---|
| 177 | * all logically-adjacent text nodes.
|
---|
| 178 | *
|
---|
| 179 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 180 | *
|
---|
| 181 | * <br>This method returns the node in the hierarchy which received the
|
---|
| 182 | * replacement text, which is null if the text was empty or is the
|
---|
| 183 | * current node if the current node is not read-only or otherwise is a
|
---|
| 184 | * new node of the same type as the current node inserted at the site of
|
---|
| 185 | * the replacement. All logically-adjacent text nodes are removed
|
---|
| 186 | * including the current node unless it was the recipient of the
|
---|
| 187 | * replacement text.
|
---|
| 188 | * <br>Where the nodes to be removed are read-only descendants of an
|
---|
| 189 | * <code>DOMEntityReference</code>, the <code>DOMEntityReference</code> must
|
---|
| 190 | * be removed instead of the read-only nodes. If any
|
---|
| 191 | * <code>DOMEntityReference</code> to be removed has descendants that are
|
---|
| 192 | * not <code>DOMEntityReference</code>, <code>DOMText</code>, or
|
---|
| 193 | * <code>DOMCDATASection</code> nodes, the <code>replaceWholeText</code>
|
---|
| 194 | * method must fail before performing any modification of the document,
|
---|
| 195 | * raising a <code>DOMException</code> with the code
|
---|
| 196 | * <code>NO_MODIFICATION_ALLOWED_ERR</code>.
|
---|
| 197 | * @param content The content of the replacing <code>DOMText</code> node.
|
---|
| 198 | * @return The <code>DOMText</code> node created with the specified content.
|
---|
| 199 | * @exception DOMException
|
---|
| 200 | * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>DOMText</code>
|
---|
| 201 | * nodes being replaced is readonly.
|
---|
| 202 | * @since DOM Level 3
|
---|
| 203 | */
|
---|
| 204 | virtual DOMText* replaceWholeText(const XMLCh* content) = 0;
|
---|
| 205 | //@}
|
---|
| 206 |
|
---|
| 207 | // -----------------------------------------------------------------------
|
---|
| 208 | // Non-standard extension
|
---|
| 209 | // -----------------------------------------------------------------------
|
---|
| 210 | /** @name Non-standard extension */
|
---|
| 211 | //@{
|
---|
| 212 | /**
|
---|
| 213 | * Non-standard extension
|
---|
| 214 | *
|
---|
| 215 | * Return true if this node contains ignorable whitespaces only.
|
---|
| 216 | * @return True if this node contains ignorable whitespaces only.
|
---|
| 217 | */
|
---|
| 218 | virtual bool isIgnorableWhitespace() const = 0;
|
---|
| 219 | //@}
|
---|
| 220 |
|
---|
| 221 | };
|
---|
| 222 |
|
---|
| 223 |
|
---|
| 224 | XERCES_CPP_NAMESPACE_END
|
---|
| 225 |
|
---|
| 226 | #endif
|
---|
| 227 |
|
---|
| 228 |
|
---|