1 package net.sf.saxon.tinytree; 2 import net.sf.saxon.event.Receiver; 3 import net.sf.saxon.trans.XPathException; 4 import net.sf.saxon.type.Type; 5 6 7 11 12 13 final class TinyCommentImpl extends TinyNodeImpl { 14 15 public TinyCommentImpl(TinyTree tree, int nodeNr) { 16 this.tree = tree; 17 this.nodeNr = nodeNr; 18 } 19 20 23 24 public final String getStringValue() { 25 int start = tree.alpha[nodeNr]; 26 int len = tree.beta[nodeNr]; 27 if (len==0) return ""; 28 char[] dest = new char[len]; 29 tree.commentBuffer.getChars(start, start+len, dest, 0); 30 return new String (dest, 0, len); 31 } 32 33 37 38 public final int getNodeKind() { 39 return Type.COMMENT; 40 } 41 42 45 46 public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId) throws XPathException { 47 out.comment(getStringValue(), 0, 0); 48 } 49 50 } 51 52 53 | Popular Tags |