1 package com.icl.saxon.output; 2 import com.icl.saxon.*; 3 import com.icl.saxon.om.NamePool; 4 import org.xml.sax.Attributes ; 5 import org.xml.sax.Locator ; 6 import java.io.*; 7 import java.util.*; 8 import javax.xml.transform.Result ; 9 import javax.xml.transform.TransformerException ; 10 11 15 16 public abstract class ProxyEmitter extends Emitter 17 { 18 protected Emitter baseEmitter; 19 protected Properties outputProperties; 20 21 24 25 public void setUnderlyingEmitter(Emitter emitter) { 26 baseEmitter = emitter; 27 if (namePool!=null) { 28 baseEmitter.setNamePool(namePool); 29 } 30 } 31 32 35 36 public void setNamePool(NamePool pool) { 37 super.setNamePool(pool); 38 if (baseEmitter!=null) { 39 baseEmitter.setNamePool(pool); 40 } 41 } 42 43 46 47 public void setWriter (Writer writer) { 48 this.writer = writer; 49 if (baseEmitter!=null) 50 baseEmitter.setWriter(writer); 51 } 52 53 56 57 public void startDocument() throws TransformerException { 58 if (baseEmitter==null) { 59 throw new TransformerException ("ProxyEmitter.startDocument(): no underlying emitter provided"); 60 } 61 baseEmitter.startDocument(); 62 } 63 64 67 68 public void endDocument() throws TransformerException { 69 if (baseEmitter!=null) { 70 baseEmitter.endDocument(); 71 } 72 } 73 74 77 78 public void startElement(int nameCode, Attributes attributes, 79 int[] namespaces, int nscount) throws TransformerException { 80 if (baseEmitter!=null) { 81 baseEmitter.startElement(nameCode, attributes, namespaces, nscount); 82 } 83 } 84 85 88 89 public void endElement(int nameCode) throws TransformerException { 90 if (baseEmitter!=null) { 91 baseEmitter.endElement(nameCode); 92 } 93 } 94 95 98 99 public void characters(char[] chars, int start, int len) throws TransformerException { 100 if (baseEmitter!=null) { 101 baseEmitter.characters(chars, start, len); 102 } 103 } 104 105 106 109 110 public void processingInstruction(String target, String data) throws TransformerException { 111 if (baseEmitter!=null) { 112 baseEmitter.processingInstruction(target, data); 113 } 114 } 115 116 119 120 public void comment (char ch[], int start, int length) throws TransformerException { 121 if (baseEmitter!=null) { 122 baseEmitter.comment(ch, start, length); 123 } 124 } 125 126 127 132 133 public void setEscaping(boolean escaping) throws TransformerException { 134 if (baseEmitter!=null) { 135 baseEmitter.setEscaping(escaping); 136 } 137 } 138 139 142 143 public void setOutputProperties (Properties details) { 144 outputProperties = details; 145 if (baseEmitter!=null) { 146 baseEmitter.setOutputProperties(details); 147 } 148 } 149 150 153 154 public void setUnparsedEntity(String name, String uri) throws TransformerException { 155 if (baseEmitter!=null) { 156 baseEmitter.setUnparsedEntity(name, uri); 157 } 158 } 159 160 163 164 public void setDocumentLocator(Locator locator) { 165 if (baseEmitter!=null) { 167 baseEmitter.setDocumentLocator(locator); 168 } 169 } 170 } 171 172 | Popular Tags |