1 package com.icl.saxon.tinytree; 2 import com.icl.saxon.om.NodeInfo; 3 import com.icl.saxon.output.Outputter; 4 5 import javax.xml.transform.TransformerException ; 6 7 12 13 14 abstract class TinyParentNodeImpl extends TinyNodeImpl { 15 16 19 20 public boolean hasChildNodes() { 21 return (nodeNr+1 < document.numberOfNodes && 22 document.depth[nodeNr+1] > document.depth[nodeNr]); 23 } 24 25 30 31 public String getStringValue() { 32 int level = document.depth[nodeNr]; 33 StringBuffer sb = null; 34 35 38 int next = nodeNr+1; 39 while (next < document.numberOfNodes && document.depth[next] > level) { 40 if (document.nodeType[next]==NodeInfo.TEXT) { 41 if (sb==null) { 42 sb = new StringBuffer (); 43 } 44 int length = document.length[next]; 45 int start = document.offset[next]; 46 sb.append(document.charBuffer, start, length); 47 } 48 next++; 49 } 50 if (sb==null) return ""; 51 return sb.toString(); 52 } 53 54 57 58 public void copyStringValue(Outputter out) throws TransformerException { 59 int level = document.depth[nodeNr]; 60 61 64 int next = nodeNr+1; 65 while (next < document.numberOfNodes && document.depth[next] > level) { 66 if (document.nodeType[next]==NodeInfo.TEXT) { 67 out.writeContent(document.charBuffer, document.offset[next], document.length[next]); 68 } 69 next++; 70 } 71 } 72 73 } 74 75 76 | Popular Tags |