1 package com.icl.saxon.tinytree; 2 import com.icl.saxon.om.*; 3 import com.icl.saxon.output.Outputter; 4 import com.icl.saxon.Context; 5 import com.icl.saxon.tree.DOMExceptionImpl; 6 7 import javax.xml.transform.TransformerException ; 8 import org.w3c.dom.Comment ; 9 import org.w3c.dom.DOMException ; 10 11 12 16 17 18 final class TinyCommentImpl extends TinyNodeImpl implements Comment { 19 20 public TinyCommentImpl(TinyDocumentImpl doc, int nodeNr) { 21 this.document = doc; 22 this.nodeNr = nodeNr; 23 } 24 25 28 29 public final String getStringValue() { 30 int start = document.offset[nodeNr]; 31 int len = document.length[nodeNr]; 32 if (len==0) return ""; char[] dest = new char[len]; 34 document.commentBuffer.getChars(start, start+len, dest, 0); 35 return new String (dest, 0, len); 36 } 37 38 42 43 public final short getNodeType() { 44 return NodeInfo.COMMENT; 45 } 46 47 50 51 public void copy(Outputter out) throws TransformerException { 52 out.writeComment(getStringValue()); 53 } 54 55 } 56 57 58 | Popular Tags |