001: /*
002: * Copyright 2003-2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * $Id: SerializationHandler.java,v 1.9 2005/04/07 04:29:03 minchau Exp $
018: */
019: package org.apache.xml.serializer;
020:
021: import java.io.IOException;
022:
023: import javax.xml.transform.Transformer;
024:
025: import org.w3c.dom.Node;
026: import org.xml.sax.ContentHandler;
027: import org.xml.sax.ErrorHandler;
028: import org.xml.sax.SAXException;
029: import org.xml.sax.ext.DeclHandler;
030:
031: /**
032: * This interface is the one that a serializer implements. It is a group of
033: * other interfaces, such as ExtendedContentHandler, ExtendedLexicalHandler etc.
034: * In addition there are other methods, such as reset().
035: *
036: * This class is public only because it is used in another package,
037: * it is not a public API.
038: *
039: * @xsl.usage internal
040: */
041: public interface SerializationHandler extends ExtendedContentHandler,
042: ExtendedLexicalHandler, XSLOutputAttributes, DeclHandler,
043: org.xml.sax.DTDHandler, ErrorHandler, DOMSerializer, Serializer {
044: /**
045: * Set the SAX Content handler that the serializer sends its output to. This
046: * method only applies to a ToSAXHandler, not to a ToStream serializer.
047: *
048: * @see Serializer#asContentHandler()
049: * @see ToSAXHandler
050: */
051: public void setContentHandler(ContentHandler ch);
052:
053: public void close();
054:
055: /**
056: * Notify that the serializer should take this DOM node as input to be
057: * serialized.
058: *
059: * @param node the DOM node to be serialized.
060: * @throws IOException
061: */
062: public void serialize(Node node) throws IOException;
063:
064: /**
065: * Turns special character escaping on/off.
066: *
067: * Note that characters will
068: * never, even if this option is set to 'true', be escaped within
069: * CDATA sections in output XML documents.
070: *
071: * @param escape true if escaping is to be set on.
072: */
073: public boolean setEscaping(boolean escape) throws SAXException;
074:
075: /**
076: * Set the number of spaces to indent for each indentation level.
077: * @param spaces the number of spaces to indent for each indentation level.
078: */
079: public void setIndentAmount(int spaces);
080:
081: /**
082: * Set the transformer associated with the serializer.
083: * @param transformer the transformer associated with the serializer.
084: */
085: public void setTransformer(Transformer transformer);
086:
087: /**
088: * Get the transformer associated with the serializer.
089: * @return Transformer the transformer associated with the serializer.
090: */
091: public Transformer getTransformer();
092:
093: /**
094: * Used only by TransformerSnapshotImpl to restore the serialization
095: * to a previous state.
096: *
097: * @param mappings NamespaceMappings
098: */
099: public void setNamespaceMappings(NamespaceMappings mappings);
100:
101: /**
102: * Flush any pending events currently queued up in the serializer. This will
103: * flush any input that the serializer has which it has not yet sent as
104: * output.
105: */
106: public void flushPending() throws SAXException;
107:
108: /**
109: * Default behavior is to expand DTD entities,
110: * that is the initall default value is true.
111: * @param expand true if DTD entities are to be expanded,
112: * false if they are to be left as DTD entity references.
113: */
114: public void setDTDEntityExpansion(boolean expand);
115:
116: }
|