#ifndef DOMText_HEADER_GUARD_ #define DOMText_HEADER_GUARD_ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMText.hpp 568078 2007-08-21 11:43:25Z amassari $ */ #include #include XERCES_CPP_NAMESPACE_BEGIN /** * The DOMText interface inherits from DOMCharacterData * and represents the textual content (termed character data in XML) of an * DOMElement or DOMAttr. If there is no markup inside * an element's content, the text is contained in a single object * implementing the DOMText interface that is the only child of * the element. If there is markup, it is parsed into the information items * (elements, comments, etc.) and DOMText nodes that form the list * of children of the element. *

When a document is first made available via the DOM, there is only one * DOMText node for each block of text. Users may create adjacent * DOMText nodes that represent the contents of a given element * without any intervening markup, but should be aware that there is no way * to represent the separations between these nodes in XML or HTML, so they * will not (in general) persist between DOM editing sessions. The * normalize() method on DOMNode merges any such * adjacent DOMText objects into a single node for each block of * text. *

See also the Document Object Model (DOM) Level 2 Core Specification. */ class CDOM_EXPORT DOMText: public DOMCharacterData { protected: // ----------------------------------------------------------------------- // Hidden constructors // ----------------------------------------------------------------------- /** @name Hidden constructors */ //@{ DOMText() {} DOMText(const DOMText &other) : DOMCharacterData(other) {} //@} private: // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- /** @name Unimplemented operators */ //@{ DOMText & operator = (const DOMText &); //@} public: // ----------------------------------------------------------------------- // All constructors are hidden, just the destructor is available // ----------------------------------------------------------------------- /** @name Destructor */ //@{ /** * Destructor * */ virtual ~DOMText() {}; //@} // ----------------------------------------------------------------------- // Virtual DOMText interface // ----------------------------------------------------------------------- /** @name Functions introduced in DOM Level 1 */ //@{ /** * Breaks this node into two nodes at the specified offset, * keeping both in the tree as siblings. After being split, this node * will contain all the content up to the offset point. A * new node of the same type, which contains all the content at and * after the offset point, is returned. If the original * node had a parent node, the new node is inserted as the next sibling * of the original node. When the offset is equal to the * length of this node, the new node has no data. * @param offset The 16-bit unit offset at which to split, starting from * 0. * @return The new node, of the same type as this node. * @exception DOMException * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater * than the number of 16-bit units in data. *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. * @since DOM Level 1 */ virtual DOMText *splitText(XMLSize_t offset) = 0; //@} /** @name Functions introduced in DOM Level 3 */ //@{ /** * Returns whether this text node contains whitespace in element content, * often abusively called "ignorable whitespace". An implementation can * only return true if, one way or another, it has access * to the relevant information (e.g., the DTD or schema). * *

"Experimental - subject to change"

* *
This attribute represents the property [element content * whitespace] defined in . * @since DOM Level 3 */ virtual bool getIsWhitespaceInElementContent() const = 0; /** * Returns all text of DOMText nodes logically-adjacent text * nodes to this node, concatenated in document order. * *

"Experimental - subject to change"

* * @since DOM Level 3 */ virtual const XMLCh* getWholeText() = 0; /** * Substitutes the a specified text for the text of the current node and * all logically-adjacent text nodes. * *

"Experimental - subject to change"

* *
This method returns the node in the hierarchy which received the * replacement text, which is null if the text was empty or is the * current node if the current node is not read-only or otherwise is a * new node of the same type as the current node inserted at the site of * the replacement. All logically-adjacent text nodes are removed * including the current node unless it was the recipient of the * replacement text. *
Where the nodes to be removed are read-only descendants of an * DOMEntityReference, the DOMEntityReference must * be removed instead of the read-only nodes. If any * DOMEntityReference to be removed has descendants that are * not DOMEntityReference, DOMText, or * DOMCDATASection nodes, the replaceWholeText * method must fail before performing any modification of the document, * raising a DOMException with the code * NO_MODIFICATION_ALLOWED_ERR. * @param content The content of the replacing DOMText node. * @return The DOMText node created with the specified content. * @exception DOMException * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the DOMText * nodes being replaced is readonly. * @since DOM Level 3 */ virtual DOMText* replaceWholeText(const XMLCh* content) = 0; //@} // ----------------------------------------------------------------------- // Non-standard extension // ----------------------------------------------------------------------- /** @name Non-standard extension */ //@{ /** * Non-standard extension * * Return true if this node contains ignorable whitespaces only. * @return True if this node contains ignorable whitespaces only. */ virtual bool isIgnorableWhitespace() const = 0; //@} }; XERCES_CPP_NAMESPACE_END #endif