1 28 29 package com.caucho.xsl; 30 31 import com.caucho.log.Log; 32 import com.caucho.util.L10N; 33 import com.caucho.xml.DOMBuilder; 34 import com.caucho.xml.QDocument; 35 36 import org.w3c.dom.Node ; 37 import org.xml.sax.SAXException ; 38 39 import javax.xml.transform.Result ; 40 import javax.xml.transform.TransformerException ; 41 import javax.xml.transform.dom.DOMSource ; 42 import javax.xml.transform.sax.TransformerHandler ; 43 import java.util.logging.Level ; 44 import java.util.logging.Logger ; 45 46 public class TransformerHandlerImpl extends DOMBuilder 47 implements TransformerHandler { 48 protected static final Logger log = Log.open(TransformerHandlerImpl.class); 49 protected static final L10N L = new L10N(TransformerHandlerImpl.class); 50 51 private javax.xml.transform.Transformer _transformer; 52 private Result _result; 53 54 TransformerHandlerImpl(javax.xml.transform.Transformer transformer) 55 { 56 _transformer = transformer; 57 58 init(new QDocument()); 59 } 60 61 public String getSystemId() 62 { 63 return "asdf"; 64 } 65 66 public javax.xml.transform.Transformer getTransformer() 67 { 68 return _transformer; 69 } 70 71 public void setResult(Result result) 72 { 73 _result = result; 74 } 75 76 public void endDocument() 77 throws SAXException 78 { 79 super.endDocument(); 80 81 Node node = getNode(); 82 DOMSource source = new DOMSource (node); 83 84 try { 85 ((TransformerImpl) _transformer).transform(source, _result); 86 } catch (TransformerException e) { 87 log.log(Level.WARNING, e.toString(), e); 88 } 89 } 90 91 public void notationDecl(String name, String publicId, String systemId) 92 { 93 } 94 95 public void unparsedEntityDecl(String name, String publicId, 96 String systemId, String notationName) 97 { 98 } 99 100 public void startDTD(String name, String publicId, String systemId) 101 throws SAXException 102 { 103 } 104 105 public void endDTD() 106 throws SAXException 107 { 108 } 109 110 public void startEntity(String name) 111 throws SAXException 112 { 113 } 114 115 public void endEntity(String name) 116 throws SAXException 117 { 118 } 119 120 public void startCDATA() 121 throws SAXException 122 { 123 } 124 125 public void endCDATA() 126 throws SAXException 127 { 128 } 129 } 130 | Popular Tags |