jaxp/src/com/sun/org/apache/xml/internal/serializer/SerializationHandler.java
author joehw
Tue, 29 Jul 2014 20:52:36 -0700
changeset 25834 aba3efbf4ec5
parent 12458 d601e4bba306
permissions -rw-r--r--
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer. Reviewed-by: lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
/*
25834
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
     6
 * Licensed to the Apache Software Foundation (ASF) under one
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
     7
 * or more contributor license agreements. See the NOTICE file
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
     8
 * distributed with this work for additional information
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
     9
 * regarding copyright ownership. The ASF licenses this file
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
    10
 * to you under the Apache License, Version 2.0 (the  "License");
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * you may not use this file except in compliance with the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 * You may obtain a copy of the License at
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 *     http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 * $Id: SerializationHandler.java,v 1.2.4.1 2005/09/15 08:15:22 suresh_emailid Exp $
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
package com.sun.org.apache.xml.internal.serializer;
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
import java.io.IOException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
import javax.xml.transform.Transformer;
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
import org.w3c.dom.Node;
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
import org.xml.sax.ContentHandler;
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
import org.xml.sax.ErrorHandler;
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
import org.xml.sax.SAXException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
import org.xml.sax.ext.DeclHandler;
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * This interface is the one that a serializer implements. It is a group of
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 * other interfaces, such as ExtendedContentHandler, ExtendedLexicalHandler etc.
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 * In addition there are other methods, such as reset().
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * This class is public only because it is used in another package,
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * it is not a public API.
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 * @xsl.usage internal
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
public interface SerializationHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
    extends
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
        ExtendedContentHandler,
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
        ExtendedLexicalHandler,
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
        XSLOutputAttributes,
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
        DeclHandler,
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
        org.xml.sax.DTDHandler,
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
        ErrorHandler,
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
        DOMSerializer,
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
        Serializer
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
{
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
     * Set the SAX Content handler that the serializer sends its output to. This
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
     * method only applies to a ToSAXHandler, not to a ToStream serializer.
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
     * @see Serializer#asContentHandler()
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
     * @see ToSAXHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
    public void setContentHandler(ContentHandler ch);
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
    public void close();
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
     * Notify that the serializer should take this DOM node as input to be
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
     * serialized.
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
     * @param node the DOM node to be serialized.
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
     * @throws IOException
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
    public void serialize(Node node) throws IOException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
     * Turns special character escaping on/off.
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
     * Note that characters will
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
     * never, even if this option is set to 'true', be escaped within
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
     * CDATA sections in output XML documents.
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
     * @param escape true if escaping is to be set on.
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
    public boolean setEscaping(boolean escape) throws SAXException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
     * Set the number of spaces to indent for each indentation level.
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
     * @param spaces the number of spaces to indent for each indentation level.
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
    public void setIndentAmount(int spaces);
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
     * Set the transformer associated with the serializer.
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
     * @param transformer the transformer associated with the serializer.
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
    public void setTransformer(Transformer transformer);
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
     * Get the transformer associated with the serializer.
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
     * @return Transformer the transformer associated with the serializer.
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
    public Transformer getTransformer();
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
     * Used only by TransformerSnapshotImpl to restore the serialization
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
     * to a previous state.
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
     * @param mappings NamespaceMappings
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
    public void setNamespaceMappings(NamespaceMappings mappings);
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
    /**
25834
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   115
     * A SerializationHandler accepts SAX-like events, so
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   116
     * it can accumulate attributes or namespace nodes after
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   117
     * a startElement().
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   118
     * <p>
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   119
     * If the SerializationHandler has a Writer or OutputStream,
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   120
     * a call to this method will flush such accumulated
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   121
     * events as a closed start tag for an element.
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   122
     * <p>
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   123
     * If the SerializationHandler wraps a ContentHandler,
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   124
     * a call to this method will flush such accumulated
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   125
     * events as a SAX (not SAX-like) calls to
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   126
     * startPrefixMapping() and startElement().
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   127
     * <p>
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   128
     * If one calls endDocument() then one need not call
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   129
     * this method since a call to endDocument() will
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   130
     * do what this method does. However, in some
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   131
     * circumstances, such as with document fragments,
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   132
     * endDocument() is not called and it may be
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   133
     * necessary to call this method to flush
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   134
     * any pending events.
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   135
     * <p>
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   136
     * For performance reasons this method should not be called
aba3efbf4ec5 8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents: 12458
diff changeset
   137
     * very often.
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
    public void flushPending() throws SAXException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
     * Default behavior is to expand DTD entities,
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
     * that is the initall default value is true.
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
     * @param expand true if DTD entities are to be expanded,
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
     * false if they are to be left as DTD entity references.
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
    public void setDTDEntityExpansion(boolean expand);
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   149
    /**
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   150
     * Specify if the output will be treated as a standalone  property
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   151
     * @param isStandalone true if the http://www.oracle.com/xml/is-standalone is set to yes
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   152
     * @see OutputPropertiesFactory ORACLE_IS_STANDALONE
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   153
     */
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   154
    public void setIsStandalone(boolean b);
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
}