1 28 29 package com.caucho.xml; 30 31 import org.w3c.dom.DOMException ; 32 import org.w3c.dom.Node ; 33 import org.w3c.dom.Text ; 34 35 38 public class QText extends QCharacterData implements Text { 39 42 public QText() 43 { 44 super(); 45 } 46 47 50 public QText(String data) 51 { 52 super(data); 53 } 54 55 public String getNodeName() { return "#text"; } 56 public short getNodeType() { return TEXT_NODE; } 57 58 Node importNode(QDocument owner, boolean deep) 59 { 60 QText text = new QText(_data); 61 text._owner = owner; 62 text._filename = _filename; 63 text._line = _line; 64 return text; 65 } 66 67 public Text splitText(int offset) 68 throws DOMException 69 { 70 QText text = new QText(_data.substring(offset)); 71 text._owner = _owner; 72 73 _data = _data.substring(0, offset); 74 75 text._parent = _parent; 76 if (_next != null) 77 _next._previous = text; 78 else if (_parent != null) 79 _parent._lastChild = text; 80 text._previous = this; 81 text._next = _next; 82 _next = text; 83 84 return text; 85 } 86 87 public Text joinText(Text node1, Text node2) 88 throws DOMException 89 { 90 return new QText(node1.getData() + node2.getData()); 91 } 92 93 public boolean getIsWhitespaceInElementContent() 95 { 96 throw new UnsupportedOperationException (); 97 } 98 99 public String getWholeText() 100 { 101 throw new UnsupportedOperationException (); 102 } 103 104 public Text replaceWholeText(String content) 105 throws DOMException 106 { 107 throw new UnsupportedOperationException (); 108 } 109 110 private Object writeReplace() 111 { 112 return new SerializedXml(this); 113 } 114 115 public String toString() 116 { 117 return "Text[" + getData() + "]"; 118 } 119 } 120 | Popular Tags |