001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: * Free SoftwareFoundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package com.caucho.xsl;
030:
031: import com.caucho.log.Log;
032: import com.caucho.util.L10N;
033: import com.caucho.xml.DOMBuilder;
034: import com.caucho.xml.QDocument;
035:
036: import org.w3c.dom.Node;
037: import org.xml.sax.SAXException;
038:
039: import javax.xml.transform.Result;
040: import javax.xml.transform.TransformerException;
041: import javax.xml.transform.dom.DOMSource;
042: import javax.xml.transform.sax.TransformerHandler;
043: import java.util.logging.Level;
044: import java.util.logging.Logger;
045:
046: public class TransformerHandlerImpl extends DOMBuilder implements
047: TransformerHandler {
048: protected static final Logger log = Log
049: .open(TransformerHandlerImpl.class);
050: protected static final L10N L = new L10N(
051: TransformerHandlerImpl.class);
052:
053: private javax.xml.transform.Transformer _transformer;
054: private Result _result;
055:
056: TransformerHandlerImpl(javax.xml.transform.Transformer transformer) {
057: _transformer = transformer;
058:
059: init(new QDocument());
060: }
061:
062: public String getSystemId() {
063: return "asdf";
064: }
065:
066: public javax.xml.transform.Transformer getTransformer() {
067: return _transformer;
068: }
069:
070: public void setResult(Result result) {
071: _result = result;
072: }
073:
074: public void endDocument() throws SAXException {
075: super .endDocument();
076:
077: Node node = getNode();
078: DOMSource source = new DOMSource(node);
079:
080: try {
081: ((TransformerImpl) _transformer).transform(source, _result);
082: } catch (TransformerException e) {
083: log.log(Level.WARNING, e.toString(), e);
084: }
085: }
086:
087: public void notationDecl(String name, String publicId,
088: String systemId) {
089: }
090:
091: public void unparsedEntityDecl(String name, String publicId,
092: String systemId, String notationName) {
093: }
094:
095: public void startDTD(String name, String publicId, String systemId)
096: throws SAXException {
097: }
098:
099: public void endDTD() throws SAXException {
100: }
101:
102: public void startEntity(String name) throws SAXException {
103: }
104:
105: public void endEntity(String name) throws SAXException {
106: }
107:
108: public void startCDATA() throws SAXException {
109: }
110:
111: public void endCDATA() throws SAXException {
112: }
113: }
|