1 package com.icl.saxon.output; 2 import com.icl.saxon.*; 3 import com.icl.saxon.charcode.UnicodeCharacterSet; 4 import java.util.*; 5 import java.io.*; 6 import org.xml.sax.Attributes ; 7 import javax.xml.transform.OutputKeys ; 8 import javax.xml.transform.TransformerException ; 9 10 14 15 final class StringEmitter extends Emitter { 16 17 20 private int ignoreElements = 0; 21 private StringBuffer buffer; 22 23 protected StringEmitter(StringBuffer buffer) { 24 this.buffer = buffer; 25 } 26 27 30 31 public void startDocument () throws TransformerException {} 32 33 36 37 public void endDocument () throws TransformerException {} 38 39 47 48 public void characters(char ch[], int start, int length) throws TransformerException { 49 if (ignoreElements == 0) { 50 buffer.append(ch, start, length); 51 } 52 } 53 54 59 60 public void startElement(int nameCode, Attributes attributes, 61 int[] namespaces, int nscount) throws TransformerException { 62 ignoreElements++; 63 } 64 65 66 71 72 public void endElement(int nameCode) throws TransformerException { 73 ignoreElements--; 74 } 75 76 80 81 public void processingInstruction(String name, String value) throws TransformerException {} 82 83 87 88 public void comment(char ch[], int start, int length) throws TransformerException {} 89 90 } 91 92 | Popular Tags |