|
||||
File indexing completed on 2025-01-18 10:14:51
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMTEXT_HPP) 0023 #define XERCESC_INCLUDE_GUARD_DOMTEXT_HPP 0024 0025 #include <xercesc/util/XercesDefs.hpp> 0026 #include <xercesc/dom/DOMCharacterData.hpp> 0027 0028 XERCES_CPP_NAMESPACE_BEGIN 0029 0030 0031 /** 0032 * The <code>DOMText</code> interface inherits from <code>DOMCharacterData</code> 0033 * and represents the textual content (termed character data in XML) of an 0034 * <code>DOMElement</code> or <code>DOMAttr</code>. If there is no markup inside 0035 * an element's content, the text is contained in a single object 0036 * implementing the <code>DOMText</code> interface that is the only child of 0037 * the element. If there is markup, it is parsed into the information items 0038 * (elements, comments, etc.) and <code>DOMText</code> nodes that form the list 0039 * of children of the element. 0040 * <p>When a document is first made available via the DOM, there is only one 0041 * <code>DOMText</code> node for each block of text. Users may create adjacent 0042 * <code>DOMText</code> nodes that represent the contents of a given element 0043 * without any intervening markup, but should be aware that there is no way 0044 * to represent the separations between these nodes in XML or HTML, so they 0045 * will not (in general) persist between DOM editing sessions. The 0046 * <code>normalize()</code> method on <code>DOMNode</code> merges any such 0047 * adjacent <code>DOMText</code> objects into a single node for each block of 0048 * text. 0049 * <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>. 0050 */ 0051 class CDOM_EXPORT DOMText: public DOMCharacterData { 0052 protected: 0053 // ----------------------------------------------------------------------- 0054 // Hidden constructors 0055 // ----------------------------------------------------------------------- 0056 /** @name Hidden constructors */ 0057 //@{ 0058 DOMText() {} 0059 DOMText(const DOMText &other) : DOMCharacterData(other) {} 0060 //@} 0061 0062 private: 0063 // ----------------------------------------------------------------------- 0064 // Unimplemented constructors and operators 0065 // ----------------------------------------------------------------------- 0066 /** @name Unimplemented operators */ 0067 //@{ 0068 DOMText & operator = (const DOMText &); 0069 //@} 0070 0071 public: 0072 // ----------------------------------------------------------------------- 0073 // All constructors are hidden, just the destructor is available 0074 // ----------------------------------------------------------------------- 0075 /** @name Destructor */ 0076 //@{ 0077 /** 0078 * Destructor 0079 * 0080 */ 0081 virtual ~DOMText() {}; 0082 //@} 0083 0084 // ----------------------------------------------------------------------- 0085 // Virtual DOMText interface 0086 // ----------------------------------------------------------------------- 0087 /** @name Functions introduced in DOM Level 1 */ 0088 //@{ 0089 /** 0090 * Breaks this node into two nodes at the specified <code>offset</code>, 0091 * keeping both in the tree as siblings. After being split, this node 0092 * will contain all the content up to the <code>offset</code> point. A 0093 * new node of the same type, which contains all the content at and 0094 * after the <code>offset</code> point, is returned. If the original 0095 * node had a parent node, the new node is inserted as the next sibling 0096 * of the original node. When the <code>offset</code> is equal to the 0097 * length of this node, the new node has no data. 0098 * @param offset The 16-bit unit offset at which to split, starting from 0099 * <code>0</code>. 0100 * @return The new node, of the same type as this node. 0101 * @exception DOMException 0102 * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater 0103 * than the number of 16-bit units in <code>data</code>. 0104 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 0105 * @since DOM Level 1 0106 */ 0107 virtual DOMText *splitText(XMLSize_t offset) = 0; 0108 //@} 0109 0110 /** @name Functions introduced in DOM Level 3 */ 0111 //@{ 0112 /** 0113 * Returns whether this text node contains element content whitespace, 0114 * often abusively called "ignorable whitespace". The text node is determined 0115 * to contain whitespace in element content during the load of the document 0116 * or if validation occurs while using <code>DOMDocument::normalizeDocument()</code>. 0117 * 0118 * @since DOM Level 3 0119 */ 0120 virtual bool getIsElementContentWhitespace() const = 0; 0121 0122 /** 0123 * Returns all text of <code>DOMText</code> nodes logically-adjacent text 0124 * nodes to this node, concatenated in document order. 0125 * 0126 * @since DOM Level 3 0127 */ 0128 virtual const XMLCh* getWholeText() const = 0; 0129 0130 /** 0131 * Substitutes the a specified text for the text of the current node and 0132 * all logically-adjacent text nodes. 0133 * 0134 * <br>This method returns the node in the hierarchy which received the 0135 * replacement text, which is null if the text was empty or is the 0136 * current node if the current node is not read-only or otherwise is a 0137 * new node of the same type as the current node inserted at the site of 0138 * the replacement. All logically-adjacent text nodes are removed 0139 * including the current node unless it was the recipient of the 0140 * replacement text. 0141 * <br>Where the nodes to be removed are read-only descendants of an 0142 * <code>DOMEntityReference</code>, the <code>DOMEntityReference</code> must 0143 * be removed instead of the read-only nodes. If any 0144 * <code>DOMEntityReference</code> to be removed has descendants that are 0145 * not <code>DOMEntityReference</code>, <code>DOMText</code>, or 0146 * <code>DOMCDATASection</code> nodes, the <code>replaceWholeText</code> 0147 * method must fail before performing any modification of the document, 0148 * raising a <code>DOMException</code> with the code 0149 * <code>NO_MODIFICATION_ALLOWED_ERR</code>. 0150 * 0151 * @param content The content of the replacing <code>DOMText</code> node. 0152 * @return The <code>DOMText</code> node created with the specified content. 0153 * @exception DOMException 0154 * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>DOMText</code> 0155 * nodes being replaced is readonly. 0156 * @since DOM Level 3 0157 */ 0158 virtual DOMText* replaceWholeText(const XMLCh* content) = 0; 0159 //@} 0160 0161 // ----------------------------------------------------------------------- 0162 // Non-standard extension 0163 // ----------------------------------------------------------------------- 0164 /** @name Non-standard extension */ 0165 //@{ 0166 /** 0167 * Non-standard extension 0168 * 0169 * Return true if this node contains ignorable whitespaces only. 0170 * @return True if this node contains ignorable whitespaces only. 0171 */ 0172 virtual bool isIgnorableWhitespace() const = 0; 0173 //@} 0174 0175 }; 0176 0177 0178 XERCES_CPP_NAMESPACE_END 0179 0180 #endif 0181 0182
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |