View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 2003-2004 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  /*
21   * $Id: SerializationHandler.java,v 1.2.4.1 2005/09/15 08:15:22 suresh_emailid Exp $
22   */
23  package com.sun.org.apache.xml.internal.serializer;
24  
25  import java.io.IOException;
26  
27  import javax.xml.transform.Transformer;
28  
29  import org.w3c.dom.Node;
30  import org.xml.sax.ContentHandler;
31  import org.xml.sax.ErrorHandler;
32  import org.xml.sax.SAXException;
33  import org.xml.sax.ext.DeclHandler;
34  
35  /**
36   * This interface is the one that a serializer implements. It is a group of
37   * other interfaces, such as ExtendedContentHandler, ExtendedLexicalHandler etc.
38   * In addition there are other methods, such as reset().
39   *
40   * This class is public only because it is used in another package,
41   * it is not a public API.
42   *
43   * @xsl.usage internal
44   */
45  public interface SerializationHandler
46      extends
47          ExtendedContentHandler,
48          ExtendedLexicalHandler,
49          XSLOutputAttributes,
50          DeclHandler,
51          org.xml.sax.DTDHandler,
52          ErrorHandler,
53          DOMSerializer,
54          Serializer
55  {
56      /**
57       * Set the SAX Content handler that the serializer sends its output to. This
58       * method only applies to a ToSAXHandler, not to a ToStream serializer.
59       *
60       * @see Serializer#asContentHandler()
61       * @see ToSAXHandler
62       */
63      public void setContentHandler(ContentHandler ch);
64  
65      public void close();
66  
67      /**
68       * Notify that the serializer should take this DOM node as input to be
69       * serialized.
70       *
71       * @param node the DOM node to be serialized.
72       * @throws IOException
73       */
74      public void serialize(Node node) throws IOException;
75      /**
76       * Turns special character escaping on/off.
77       *
78       * Note that characters will
79       * never, even if this option is set to 'true', be escaped within
80       * CDATA sections in output XML documents.
81       *
82       * @param escape true if escaping is to be set on.
83       */
84      public boolean setEscaping(boolean escape) throws SAXException;
85  
86      /**
87       * Set the number of spaces to indent for each indentation level.
88       * @param spaces the number of spaces to indent for each indentation level.
89       */
90      public void setIndentAmount(int spaces);
91  
92      /**
93       * Set the transformer associated with the serializer.
94       * @param transformer the transformer associated with the serializer.
95       */
96      public void setTransformer(Transformer transformer);
97  
98      /**
99       * Get the transformer associated with the serializer.
100      * @return Transformer the transformer associated with the serializer.
101      */
102     public Transformer getTransformer();
103 
104     /**
105      * Used only by TransformerSnapshotImpl to restore the serialization
106      * to a previous state.
107      *
108      * @param mappings NamespaceMappings
109      */
110     public void setNamespaceMappings(NamespaceMappings mappings);
111 
112     /**
113      * Flush any pending events currently queued up in the serializer. This will
114      * flush any input that the serializer has which it has not yet sent as
115      * output.
116      */
117     public void flushPending() throws SAXException;
118 
119     /**
120      * Default behavior is to expand DTD entities,
121      * that is the initall default value is true.
122      * @param expand true if DTD entities are to be expanded,
123      * false if they are to be left as DTD entity references.
124      */
125     public void setDTDEntityExpansion(boolean expand);
126 
127     /**
128      * Specify if the output will be treated as a standalone  property
129      * @param isStandalone true if the http://www.oracle.com/xml/is-standalone is set to yes
130      * @see OutputPropertiesFactory ORACLE_IS_STANDALONE
131      */
132     public void setIsStandalone(boolean b);
133 
134 }