1 57 58 package org.enhydra.apache.xerces.dom; 59 60 import org.w3c.dom.CharacterData ; 61 import org.w3c.dom.DOMException ; 62 import org.w3c.dom.Node ; 63 import org.w3c.dom.Text ; 64 65 81 public class TextImpl 82 extends CharacterDataImpl 83 implements CharacterData , Text { 84 85 89 90 static final long serialVersionUID = -5294980852957403469L; 91 92 96 97 public TextImpl(CoreDocumentImpl ownerDoc, String data) { 98 super(ownerDoc, data); 99 } 100 101 105 109 public short getNodeType() { 110 return Node.TEXT_NODE; 111 } 112 113 114 public String getNodeName() { 115 return "#text"; 116 } 117 118 121 public void setIgnorableWhitespace(boolean ignore) { 122 123 if (needsSyncData()) { 124 synchronizeData(); 125 } 126 isIgnorableWhitespace(ignore); 127 128 } 130 131 134 public boolean isIgnorableWhitespace() { 135 136 if (needsSyncData()) { 137 synchronizeData(); 138 } 139 return internalIsIgnorableWhitespace(); 140 141 } 143 147 163 public Text splitText(int offset) 164 throws DOMException { 165 166 if (isReadOnly()) { 167 throw new DOMException ( 168 DOMException.NO_MODIFICATION_ALLOWED_ERR, 169 "DOM001 Modification not allowed"); 170 } 171 172 if (needsSyncData()) { 173 synchronizeData(); 174 } 175 if (offset < 0 || offset > data.length() ) { 176 throw new DOMException (DOMException.INDEX_SIZE_ERR, 177 "DOM004 Index out of bounds"); 178 } 179 180 Text newText = 182 getOwnerDocument().createTextNode(data.substring(offset)); 183 setNodeValue(data.substring(0, offset)); 184 185 Node parentNode = getParentNode(); 187 if (parentNode != null) { 188 parentNode.insertBefore(newText, nextSibling); 189 } 190 191 return newText; 192 193 } 195 196 199 public boolean isElementContentWhitespace() { 200 return false; 202 } 203 206 public String getWholeText() { 207 return null; 209 } 210 213 public Text replaceWholeText(String content) throws DOMException { 214 return null; 216 } 217 218 } | Popular Tags |