1 28 29 package com.caucho.xml; 30 31 import org.w3c.dom.CDATASection ; 32 import org.w3c.dom.DOMException ; 33 import org.w3c.dom.Text ; 34 35 import java.io.IOException ; 36 37 public class QCdata extends QText implements CDATASection { 38 public QCdata(String data) 39 { 40 super(data); 41 } 42 43 public String getNodeName() { return "#cdata-section"; } 44 public short getNodeType() { return CDATA_SECTION_NODE; } 45 46 public Text splitText(int offset) 47 throws DOMException 48 { 49 QCdata text = new QCdata(_data.substring(offset)); 50 text._owner = _owner; 51 52 _data = _data.substring(0, offset); 53 54 text._parent = _parent; 55 if (_next != null) 56 _next._previous = text; 57 else if (_parent != null) 58 _parent._lastChild = text; 59 text._previous = this; 60 text._next = _next; 61 _next = text; 62 63 return text; 64 } 65 66 private Object writeReplace() 67 { 68 return new SerializedXml(this); 69 } 70 71 public void print(XmlPrinter os) throws IOException 72 { 73 os.cdata(getData()); 74 } 75 } 76 | Popular Tags |