jaxp/src/share/classes/org/w3c/dom/ls/LSSerializer.java
author tonyp
Wed, 19 Aug 2009 12:53:25 -0400
changeset 3691 c84b8483cd2c
parent 6 7f561c08de6b
permissions -rw-r--r--
6871111: G1: remove the concurrent overhead tracker Summary: Removing the concurrent overhead tracker from G1, along with the GC overhead reporter and the G1AccountConcurrentOverhead (both of which rely on the the concurrent overhead tracker). Reviewed-by: iveresov, johnc
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
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Sun designates this
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * by Sun in the LICENSE file that accompanied this code.
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * accompanied this code).
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * CA 95054 USA or visit www.sun.com if you need additional information or
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 * have any questions.
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
 * This file is available under and governed by the GNU General Public
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
 * License version 2 only, as published by the Free Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
 * However, the following notice accompanied the original version of this
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
 * file and, per its terms, should not be removed:
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 * Copyright (c) 2004 World Wide Web Consortium,
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 * (Massachusetts Institute of Technology, European Research Consortium for
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * Informatics and Mathematics, Keio University). All Rights Reserved. This
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 * work is distributed under the W3C(r) Software License [1] in the hope that
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
package org.w3c.dom.ls;
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
import org.w3c.dom.DOMConfiguration;
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
import org.w3c.dom.Node;
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
import org.w3c.dom.DOMException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 *  A <code>LSSerializer</code> provides an API for serializing (writing) a
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * DOM document out into XML. The XML data is written to a string or an
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
 * output stream. Any changes or fixups made during the serialization affect
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 * only the serialized data. The <code>Document</code> object and its
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 * children are never altered by the serialization operation.
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 * <p> During serialization of XML data, namespace fixup is done as defined in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 * , Appendix B. [<a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>DOM Level 2 Core</a>]
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 *  allows empty strings as a real namespace URI. If the
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
 * <code>namespaceURI</code> of a <code>Node</code> is empty string, the
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
 * serialization will treat them as <code>null</code>, ignoring the prefix
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
 * if any.
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
 * <p> <code>LSSerializer</code> accepts any node type for serialization. For
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
 * nodes of type <code>Document</code> or <code>Entity</code>, well-formed
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
 * XML will be created when possible (well-formedness is guaranteed if the
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
 * document or entity comes from a parse operation and is unchanged since it
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
 * was created). The serialized output for these node types is either as a
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
 * XML document or an External XML Entity, respectively, and is acceptable
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
 * input for an XML parser. For all other types of nodes the serialized form
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
 * is implementation dependent.
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
 * <p>Within a <code>Document</code>, <code>DocumentFragment</code>, or
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
 * <code>Entity</code> being serialized, <code>Nodes</code> are processed as
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
 * follows
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
 * <ul>
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
 * <li> <code>Document</code> nodes are written, including the XML
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
 * declaration (unless the parameter "xml-declaration" is set to
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
 * <code>false</code>) and a DTD subset, if one exists in the DOM. Writing a
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
 * <code>Document</code> node serializes the entire document.
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
 * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
 * <li>
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
 * <code>Entity</code> nodes, when written directly by
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
 * <code>LSSerializer.write</code>, outputs the entity expansion but no
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
 * namespace fixup is done. The resulting output will be valid as an
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
 * external entity.
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
 * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
 * <li> If the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-entities'>
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
 * entities</a>" is set to <code>true</code>, <code>EntityReference</code> nodes are
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
 * serialized as an entity reference of the form "
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
 * <code>&amp;entityName;</code>" in the output. Child nodes (the expansion)
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
 * of the entity reference are ignored. If the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-entities'>
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
 * entities</a>" is set to <code>false</code>, only the children of the entity reference
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
 * are serialized. <code>EntityReference</code> nodes with no children (no
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
 * corresponding <code>Entity</code> node or the corresponding
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
 * <code>Entity</code> nodes have no children) are always serialized.
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
 * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
 * <li>
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
 * <code>CDATAsections</code> containing content characters that cannot be
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
 * represented in the specified output encoding are handled according to the
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
 * "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-split-cdata-sections'>
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
 * split-cdata-sections</a>" parameter.  If the parameter is set to <code>true</code>,
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
 * <code>CDATAsections</code> are split, and the unrepresentable characters
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
 * are serialized as numeric character references in ordinary content. The
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
 * exact position and number of splits is not specified.  If the parameter
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
 * is set to <code>false</code>, unrepresentable characters in a
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
 * <code>CDATAsection</code> are reported as
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
 * <code>"wf-invalid-character"</code> errors if the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-well-formed'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
 * well-formed</a>" is set to <code>true</code>. The error is not recoverable - there is no
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
 * mechanism for supplying alternative characters and continuing with the
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
 * serialization.
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
 * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
 * <li> <code>DocumentFragment</code> nodes are serialized by
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
 * serializing the children of the document fragment in the order they
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
 * appear in the document fragment.
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
 * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
 * <li> All other node types (Element, Text,
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
 * etc.) are serialized to their corresponding XML source form.
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
 * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
 * </ul>
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
 * <p ><b>Note:</b>  The serialization of a <code>Node</code> does not always
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
 * generate a well-formed XML document, i.e. a <code>LSParser</code> might
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
 * throw fatal errors when parsing the resulting serialization.
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
 * <p> Within the character data of a document (outside of markup), any
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
 * characters that cannot be represented directly are replaced with
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
 * character references. Occurrences of '&lt;' and '&amp;' are replaced by
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
 * the predefined entities &amp;lt; and &amp;amp;. The other predefined
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
 * entities (&amp;gt;, &amp;apos;, and &amp;quot;) might not be used, except
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
 * where needed (e.g. using &amp;gt; in cases such as ']]&gt;'). Any
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
 * characters that cannot be represented directly in the output character
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
 * encoding are serialized as numeric character references (and since
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
 * character encoding standards commonly use hexadecimal representations of
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
 * characters, using the hexadecimal representation when serializing
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
 * character references is encouraged).
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
 * <p> To allow attribute values to contain both single and double quotes, the
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
 * apostrophe or single-quote character (') may be represented as
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
 * "&amp;apos;", and the double-quote character (")  as "&amp;quot;". New
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
 * line characters and other characters that cannot be represented directly
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
 * in attribute values in the output character encoding are serialized as a
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
 * numeric character reference.
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
 * <p> Within markup, but outside of attributes, any occurrence of a character
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
 * that cannot be represented in the output character encoding is reported
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
 * as a <code>DOMError</code> fatal error. An example would be serializing
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
 * the element &lt;LaCa\u00f1ada/&gt; with <code>encoding="us-ascii"</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
 * This will result with a generation of a <code>DOMError</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
 * "wf-invalid-character-in-node-name" (as proposed in "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-well-formed'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
 * well-formed</a>").
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
 * <p> When requested by setting the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-normalize-characters'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
 * normalize-characters</a>" on <code>LSSerializer</code> to true, character normalization is
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
 * performed according to the definition of <a href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
 * normalized</a> characters included in appendix E of [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>] on all
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
 * data to be serialized, both markup and character data. The character
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
 * normalization process affects only the data as it is being written; it
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
 * does not alter the DOM's view of the document after serialization has
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
 * completed.
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
 * <p> Implementations are required to support the encodings "UTF-8",
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
 * "UTF-16", "UTF-16BE", and "UTF-16LE" to guarantee that data is
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
 * serializable in all encodings that are required to be supported by all
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
 * XML parsers. When the encoding is UTF-8, whether or not a byte order mark
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
 * is serialized, or if the output is big-endian or little-endian, is
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
 * implementation dependent. When the encoding is UTF-16, whether or not the
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
 * output is big-endian or little-endian is implementation dependent, but a
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
 * Byte Order Mark must be generated for non-character outputs, such as
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
 * <code>LSOutput.byteStream</code> or <code>LSOutput.systemId</code>. If
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
 * the Byte Order Mark is not generated, a "byte-order-mark-needed" warning
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
 * is reported. When the encoding is UTF-16LE or UTF-16BE, the output is
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
 * big-endian (UTF-16BE) or little-endian (UTF-16LE) and the Byte Order Mark
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
 * is not be generated. In all cases, the encoding declaration, if
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
 * generated, will correspond to the encoding used during the serialization
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
 * (e.g. <code>encoding="UTF-16"</code> will appear if UTF-16 was
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
 * requested).
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
 * <p> Namespaces are fixed up during serialization, the serialization process
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
 * will verify that namespace declarations, namespace prefixes and the
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
 * namespace URI associated with elements and attributes are consistent. If
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
 * inconsistencies are found, the serialized form of the document will be
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
 * altered to remove them. The method used for doing the namespace fixup
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
 * while serializing a document is the algorithm defined in Appendix B.1,
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
 * "Namespace normalization", of [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
 * .
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
 * <p> While serializing a document, the parameter "discard-default-content"
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
 * controls whether or not non-specified data is serialized.
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
 * <p> While serializing, errors and warnings are reported to the application
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
 * through the error handler (<code>LSSerializer.domConfig</code>'s "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
 * error-handler</a>" parameter). This specification does in no way try to define all possible
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
 * errors and warnings that can occur while serializing a DOM node, but some
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
 * common error and warning cases are defined. The types (
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
 * <code>DOMError.type</code>) of errors and warnings defined by this
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
 * specification are:
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
 * <dl>
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
 * <dt><code>"no-output-specified" [fatal]</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
 * <dd> Raised when
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
 * writing to a <code>LSOutput</code> if no output is specified in the
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
 * <code>LSOutput</code>. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
 * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
 * <code>"unbound-prefix-in-entity-reference" [fatal]</code> </dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
 * <dd> Raised if the
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
 * configuration parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-namespaces'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
 * namespaces</a>" is set to <code>true</code> and an entity whose replacement text
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
 * contains unbound namespace prefixes is referenced in a location where
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
 * there are no bindings for the namespace prefixes. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
 * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
 * <code>"unsupported-encoding" [fatal]</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
 * <dd> Raised if an unsupported
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
 * encoding is encountered. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
 * </dl>
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
 * <p> In addition to raising the defined errors and warnings, implementations
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
 * are expected to raise implementation specific errors and warnings for any
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
 * other error and warning cases such as IO errors (file not found,
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
 * permission denied,...) and so on.
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
 * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>Document Object Model (DOM) Level 3 Load
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
and Save Specification</a>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
public interface LSSerializer {
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
     *  The <code>DOMConfiguration</code> object used by the
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
     * <code>LSSerializer</code> when serializing a DOM node.
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
     * <br> In addition to the parameters recognized by the <a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMConfiguration'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
     * DOMConfiguration</a> interface defined in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
     * , the <code>DOMConfiguration</code> objects for
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
     * <code>LSSerializer</code> adds, or modifies, the following
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
     * parameters:
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
     * <dl>
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
     * <dt><code>"canonical-form"</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
     * <dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
     * <dl>
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
     * <dt><code>true</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
     * <dd>[<em>optional</em>] Writes the document according to the rules specified in [<a href='http://www.w3.org/TR/2001/REC-xml-c14n-20010315'>Canonical XML</a>].
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
     * In addition to the behavior described in "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-canonical-form'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
     * canonical-form</a>" [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
     * , setting this parameter to <code>true</code> will set the parameters
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
     * "format-pretty-print", "discard-default-content", and "xml-declaration
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
     * ", to <code>false</code>. Setting one of those parameters to
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
     * <code>true</code> will set this parameter to <code>false</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
     * Serializing an XML 1.1 document when "canonical-form" is
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
     * <code>true</code> will generate a fatal error. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
     * <dt><code>false</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
     * <dd>[<em>required</em>] (<em>default</em>) Do not canonicalize the output. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
     * </dl></dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
     * <dt><code>"discard-default-content"</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
     * <dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
     * <dl>
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
     * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
     * <code>true</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
     * <dd>[<em>required</em>] (<em>default</em>) Use the <code>Attr.specified</code> attribute to decide what attributes
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
     * should be discarded. Note that some implementations might use
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
     * whatever information available to the implementation (i.e. XML
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
     * schema, DTD, the <code>Attr.specified</code> attribute, and so on) to
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
     * determine what attributes and content to discard if this parameter is
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
     * set to <code>true</code>. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
     * <dt><code>false</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
     * <dd>[<em>required</em>]Keep all attributes and all content.</dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
     * </dl></dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
     * <dt><code>"format-pretty-print"</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
     * <dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
     * <dl>
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
     * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
     * <code>true</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
     * <dd>[<em>optional</em>] Formatting the output by adding whitespace to produce a pretty-printed,
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
     * indented, human-readable form. The exact form of the transformations
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
     * is not specified by this specification. Pretty-printing changes the
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
     * content of the document and may affect the validity of the document,
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
     * validating implementations should preserve validity. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
     * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
     * <code>false</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
     * <dd>[<em>required</em>] (<em>default</em>) Don't pretty-print the result. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
     * </dl></dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
     * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
     * <code>"ignore-unknown-character-denormalizations"</code> </dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
     * <dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
     * <dl>
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
     * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
     * <code>true</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
     * <dd>[<em>required</em>] (<em>default</em>) If, while verifying full normalization when [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>] is
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
     * supported, a character is encountered for which the normalization
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
     * properties cannot be determined, then raise a
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
     * <code>"unknown-character-denormalization"</code> warning (instead of
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
     * raising an error, if this parameter is not set) and ignore any
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
     * possible denormalizations caused by these characters. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
     * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
     * <code>false</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
     * <dd>[<em>optional</em>] Report a fatal error if a character is encountered for which the
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
     * processor cannot determine the normalization properties. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
     * </dl></dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
     * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
     * <code>"normalize-characters"</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
     * <dd> This parameter is equivalent to
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
     * the one defined by <code>DOMConfiguration</code> in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
     * . Unlike in the Core, the default value for this parameter is
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
     * <code>true</code>. While DOM implementations are not required to
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
     * support <a href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
     * normalizing</a> the characters in the document according to appendix E of [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>], this
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
     * parameter must be activated by default if supported. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   288
     * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   289
     * <code>"xml-declaration"</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   290
     * <dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   291
     * <dl>
7f561c08de6b Initial load
duke
parents:
diff changeset
   292
     * <dt><code>true</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   293
     * <dd>[<em>required</em>] (<em>default</em>) If a <code>Document</code>, <code>Element</code>, or <code>Entity</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
   294
     *  node is serialized, the XML declaration, or text declaration, should
7f561c08de6b Initial load
duke
parents:
diff changeset
   295
     * be included. The version (<code>Document.xmlVersion</code> if the
7f561c08de6b Initial load
duke
parents:
diff changeset
   296
     * document is a Level 3 document and the version is non-null, otherwise
7f561c08de6b Initial load
duke
parents:
diff changeset
   297
     * use the value "1.0"), and the output encoding (see
7f561c08de6b Initial load
duke
parents:
diff changeset
   298
     * <code>LSSerializer.write</code> for details on how to find the output
7f561c08de6b Initial load
duke
parents:
diff changeset
   299
     * encoding) are specified in the serialized XML declaration. </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   300
     * <dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   301
     * <code>false</code></dt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   302
     * <dd>[<em>required</em>] Do not serialize the XML and text declarations. Report a
7f561c08de6b Initial load
duke
parents:
diff changeset
   303
     * <code>"xml-declaration-needed"</code> warning if this will cause
7f561c08de6b Initial load
duke
parents:
diff changeset
   304
     * problems (i.e. the serialized data is of an XML version other than [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>], or an
7f561c08de6b Initial load
duke
parents:
diff changeset
   305
     * encoding would be needed to be able to re-parse the serialized data). </dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   306
     * </dl></dd>
7f561c08de6b Initial load
duke
parents:
diff changeset
   307
     * </dl>
7f561c08de6b Initial load
duke
parents:
diff changeset
   308
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   309
    public DOMConfiguration getDomConfig();
7f561c08de6b Initial load
duke
parents:
diff changeset
   310
7f561c08de6b Initial load
duke
parents:
diff changeset
   311
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   312
     *  The end-of-line sequence of characters to be used in the XML being
7f561c08de6b Initial load
duke
parents:
diff changeset
   313
     * written out. Any string is supported, but XML treats only a certain
7f561c08de6b Initial load
duke
parents:
diff changeset
   314
     * set of characters sequence as end-of-line (See section 2.11,
7f561c08de6b Initial load
duke
parents:
diff changeset
   315
     * "End-of-Line Handling" in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>], if the
7f561c08de6b Initial load
duke
parents:
diff changeset
   316
     * serialized content is XML 1.0 or section 2.11, "End-of-Line Handling"
7f561c08de6b Initial load
duke
parents:
diff changeset
   317
     * in [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>], if the
7f561c08de6b Initial load
duke
parents:
diff changeset
   318
     * serialized content is XML 1.1). Using other character sequences than
7f561c08de6b Initial load
duke
parents:
diff changeset
   319
     * the recommended ones can result in a document that is either not
7f561c08de6b Initial load
duke
parents:
diff changeset
   320
     * serializable or not well-formed).
7f561c08de6b Initial load
duke
parents:
diff changeset
   321
     * <br> On retrieval, the default value of this attribute is the
7f561c08de6b Initial load
duke
parents:
diff changeset
   322
     * implementation specific default end-of-line sequence. DOM
7f561c08de6b Initial load
duke
parents:
diff changeset
   323
     * implementations should choose the default to match the usual
7f561c08de6b Initial load
duke
parents:
diff changeset
   324
     * convention for text files in the environment being used.
7f561c08de6b Initial load
duke
parents:
diff changeset
   325
     * Implementations must choose a default sequence that matches one of
7f561c08de6b Initial load
duke
parents:
diff changeset
   326
     * those allowed by XML 1.0 or XML 1.1, depending on the serialized
7f561c08de6b Initial load
duke
parents:
diff changeset
   327
     * content. Setting this attribute to <code>null</code> will reset its
7f561c08de6b Initial load
duke
parents:
diff changeset
   328
     * value to the default value.
7f561c08de6b Initial load
duke
parents:
diff changeset
   329
     * <br>
7f561c08de6b Initial load
duke
parents:
diff changeset
   330
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   331
    public String getNewLine();
7f561c08de6b Initial load
duke
parents:
diff changeset
   332
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   333
     *  The end-of-line sequence of characters to be used in the XML being
7f561c08de6b Initial load
duke
parents:
diff changeset
   334
     * written out. Any string is supported, but XML treats only a certain
7f561c08de6b Initial load
duke
parents:
diff changeset
   335
     * set of characters sequence as end-of-line (See section 2.11,
7f561c08de6b Initial load
duke
parents:
diff changeset
   336
     * "End-of-Line Handling" in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>], if the
7f561c08de6b Initial load
duke
parents:
diff changeset
   337
     * serialized content is XML 1.0 or section 2.11, "End-of-Line Handling"
7f561c08de6b Initial load
duke
parents:
diff changeset
   338
     * in [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>], if the
7f561c08de6b Initial load
duke
parents:
diff changeset
   339
     * serialized content is XML 1.1). Using other character sequences than
7f561c08de6b Initial load
duke
parents:
diff changeset
   340
     * the recommended ones can result in a document that is either not
7f561c08de6b Initial load
duke
parents:
diff changeset
   341
     * serializable or not well-formed).
7f561c08de6b Initial load
duke
parents:
diff changeset
   342
     * <br> On retrieval, the default value of this attribute is the
7f561c08de6b Initial load
duke
parents:
diff changeset
   343
     * implementation specific default end-of-line sequence. DOM
7f561c08de6b Initial load
duke
parents:
diff changeset
   344
     * implementations should choose the default to match the usual
7f561c08de6b Initial load
duke
parents:
diff changeset
   345
     * convention for text files in the environment being used.
7f561c08de6b Initial load
duke
parents:
diff changeset
   346
     * Implementations must choose a default sequence that matches one of
7f561c08de6b Initial load
duke
parents:
diff changeset
   347
     * those allowed by XML 1.0 or XML 1.1, depending on the serialized
7f561c08de6b Initial load
duke
parents:
diff changeset
   348
     * content. Setting this attribute to <code>null</code> will reset its
7f561c08de6b Initial load
duke
parents:
diff changeset
   349
     * value to the default value.
7f561c08de6b Initial load
duke
parents:
diff changeset
   350
     * <br>
7f561c08de6b Initial load
duke
parents:
diff changeset
   351
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   352
    public void setNewLine(String newLine);
7f561c08de6b Initial load
duke
parents:
diff changeset
   353
7f561c08de6b Initial load
duke
parents:
diff changeset
   354
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   355
     *  When the application provides a filter, the serializer will call out
7f561c08de6b Initial load
duke
parents:
diff changeset
   356
     * to the filter before serializing each Node. The filter implementation
7f561c08de6b Initial load
duke
parents:
diff changeset
   357
     * can choose to remove the node from the stream or to terminate the
7f561c08de6b Initial load
duke
parents:
diff changeset
   358
     * serialization early.
7f561c08de6b Initial load
duke
parents:
diff changeset
   359
     * <br> The filter is invoked after the operations requested by the
7f561c08de6b Initial load
duke
parents:
diff changeset
   360
     * <code>DOMConfiguration</code> parameters have been applied. For
7f561c08de6b Initial load
duke
parents:
diff changeset
   361
     * example, CDATA sections won't be passed to the filter if "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-cdata-sections'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   362
     * cdata-sections</a>" is set to <code>false</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   363
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   364
    public LSSerializerFilter getFilter();
7f561c08de6b Initial load
duke
parents:
diff changeset
   365
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   366
     *  When the application provides a filter, the serializer will call out
7f561c08de6b Initial load
duke
parents:
diff changeset
   367
     * to the filter before serializing each Node. The filter implementation
7f561c08de6b Initial load
duke
parents:
diff changeset
   368
     * can choose to remove the node from the stream or to terminate the
7f561c08de6b Initial load
duke
parents:
diff changeset
   369
     * serialization early.
7f561c08de6b Initial load
duke
parents:
diff changeset
   370
     * <br> The filter is invoked after the operations requested by the
7f561c08de6b Initial load
duke
parents:
diff changeset
   371
     * <code>DOMConfiguration</code> parameters have been applied. For
7f561c08de6b Initial load
duke
parents:
diff changeset
   372
     * example, CDATA sections won't be passed to the filter if "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-cdata-sections'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   373
     * cdata-sections</a>" is set to <code>false</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   374
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   375
    public void setFilter(LSSerializerFilter filter);
7f561c08de6b Initial load
duke
parents:
diff changeset
   376
7f561c08de6b Initial load
duke
parents:
diff changeset
   377
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   378
     *  Serialize the specified node as described above in the general
7f561c08de6b Initial load
duke
parents:
diff changeset
   379
     * description of the <code>LSSerializer</code> interface. The output is
7f561c08de6b Initial load
duke
parents:
diff changeset
   380
     * written to the supplied <code>LSOutput</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   381
     * <br> When writing to a <code>LSOutput</code>, the encoding is found by
7f561c08de6b Initial load
duke
parents:
diff changeset
   382
     * looking at the encoding information that is reachable through the
7f561c08de6b Initial load
duke
parents:
diff changeset
   383
     * <code>LSOutput</code> and the item to be written (or its owner
7f561c08de6b Initial load
duke
parents:
diff changeset
   384
     * document) in this order:
7f561c08de6b Initial load
duke
parents:
diff changeset
   385
     * <ol>
7f561c08de6b Initial load
duke
parents:
diff changeset
   386
     * <li> <code>LSOutput.encoding</code>,
7f561c08de6b Initial load
duke
parents:
diff changeset
   387
     * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
   388
     * <li>
7f561c08de6b Initial load
duke
parents:
diff changeset
   389
     * <code>Document.inputEncoding</code>,
7f561c08de6b Initial load
duke
parents:
diff changeset
   390
     * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
   391
     * <li>
7f561c08de6b Initial load
duke
parents:
diff changeset
   392
     * <code>Document.xmlEncoding</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   393
     * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
   394
     * </ol>
7f561c08de6b Initial load
duke
parents:
diff changeset
   395
     * <br> If no encoding is reachable through the above properties, a
7f561c08de6b Initial load
duke
parents:
diff changeset
   396
     * default encoding of "UTF-8" will be used. If the specified encoding
7f561c08de6b Initial load
duke
parents:
diff changeset
   397
     * is not supported an "unsupported-encoding" fatal error is raised.
7f561c08de6b Initial load
duke
parents:
diff changeset
   398
     * <br> If no output is specified in the <code>LSOutput</code>, a
7f561c08de6b Initial load
duke
parents:
diff changeset
   399
     * "no-output-specified" fatal error is raised.
7f561c08de6b Initial load
duke
parents:
diff changeset
   400
     * <br> The implementation is responsible of associating the appropriate
7f561c08de6b Initial load
duke
parents:
diff changeset
   401
     * media type with the serialized data.
7f561c08de6b Initial load
duke
parents:
diff changeset
   402
     * <br> When writing to a HTTP URI, a HTTP PUT is performed. When writing
7f561c08de6b Initial load
duke
parents:
diff changeset
   403
     * to other types of URIs, the mechanism for writing the data to the URI
7f561c08de6b Initial load
duke
parents:
diff changeset
   404
     * is implementation dependent.
7f561c08de6b Initial load
duke
parents:
diff changeset
   405
     * @param nodeArg  The node to serialize.
7f561c08de6b Initial load
duke
parents:
diff changeset
   406
     * @param destination The destination for the serialized DOM.
7f561c08de6b Initial load
duke
parents:
diff changeset
   407
     * @return  Returns <code>true</code> if <code>node</code> was
7f561c08de6b Initial load
duke
parents:
diff changeset
   408
     *   successfully serialized. Return <code>false</code> in case the
7f561c08de6b Initial load
duke
parents:
diff changeset
   409
     *   normal processing stopped but the implementation kept serializing
7f561c08de6b Initial load
duke
parents:
diff changeset
   410
     *   the document; the result of the serialization being implementation
7f561c08de6b Initial load
duke
parents:
diff changeset
   411
     *   dependent then.
7f561c08de6b Initial load
duke
parents:
diff changeset
   412
     * @exception LSException
7f561c08de6b Initial load
duke
parents:
diff changeset
   413
     *    SERIALIZE_ERR: Raised if the <code>LSSerializer</code> was unable to
7f561c08de6b Initial load
duke
parents:
diff changeset
   414
     *   serialize the node. DOM applications should attach a
7f561c08de6b Initial load
duke
parents:
diff changeset
   415
     *   <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   416
     *   error-handler</a>" if they wish to get details on the error.
7f561c08de6b Initial load
duke
parents:
diff changeset
   417
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   418
    public boolean write(Node nodeArg,
7f561c08de6b Initial load
duke
parents:
diff changeset
   419
                         LSOutput destination)
7f561c08de6b Initial load
duke
parents:
diff changeset
   420
                         throws LSException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   421
7f561c08de6b Initial load
duke
parents:
diff changeset
   422
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   423
     *  A convenience method that acts as if <code>LSSerializer.write</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
   424
     * was called with a <code>LSOutput</code> with no encoding specified
7f561c08de6b Initial load
duke
parents:
diff changeset
   425
     * and <code>LSOutput.systemId</code> set to the <code>uri</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
   426
     * argument.
7f561c08de6b Initial load
duke
parents:
diff changeset
   427
     * @param nodeArg  The node to serialize.
7f561c08de6b Initial load
duke
parents:
diff changeset
   428
     * @param uri The URI to write to.
7f561c08de6b Initial load
duke
parents:
diff changeset
   429
     * @return  Returns <code>true</code> if <code>node</code> was
7f561c08de6b Initial load
duke
parents:
diff changeset
   430
     *   successfully serialized. Return <code>false</code> in case the
7f561c08de6b Initial load
duke
parents:
diff changeset
   431
     *   normal processing stopped but the implementation kept serializing
7f561c08de6b Initial load
duke
parents:
diff changeset
   432
     *   the document; the result of the serialization being implementation
7f561c08de6b Initial load
duke
parents:
diff changeset
   433
     *   dependent then.
7f561c08de6b Initial load
duke
parents:
diff changeset
   434
     * @exception LSException
7f561c08de6b Initial load
duke
parents:
diff changeset
   435
     *    SERIALIZE_ERR: Raised if the <code>LSSerializer</code> was unable to
7f561c08de6b Initial load
duke
parents:
diff changeset
   436
     *   serialize the node. DOM applications should attach a
7f561c08de6b Initial load
duke
parents:
diff changeset
   437
     *   <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   438
     *   error-handler</a>" if they wish to get details on the error.
7f561c08de6b Initial load
duke
parents:
diff changeset
   439
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   440
    public boolean writeToURI(Node nodeArg,
7f561c08de6b Initial load
duke
parents:
diff changeset
   441
                              String uri)
7f561c08de6b Initial load
duke
parents:
diff changeset
   442
                              throws LSException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   443
7f561c08de6b Initial load
duke
parents:
diff changeset
   444
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   445
     *  Serialize the specified node as described above in the general
7f561c08de6b Initial load
duke
parents:
diff changeset
   446
     * description of the <code>LSSerializer</code> interface. The output is
7f561c08de6b Initial load
duke
parents:
diff changeset
   447
     * written to a <code>DOMString</code> that is returned to the caller.
7f561c08de6b Initial load
duke
parents:
diff changeset
   448
     * The encoding used is the encoding of the <code>DOMString</code> type,
7f561c08de6b Initial load
duke
parents:
diff changeset
   449
     * i.e. UTF-16. Note that no Byte Order Mark is generated in a
7f561c08de6b Initial load
duke
parents:
diff changeset
   450
     * <code>DOMString</code> object.
7f561c08de6b Initial load
duke
parents:
diff changeset
   451
     * @param nodeArg  The node to serialize.
7f561c08de6b Initial load
duke
parents:
diff changeset
   452
     * @return  Returns the serialized data.
7f561c08de6b Initial load
duke
parents:
diff changeset
   453
     * @exception DOMException
7f561c08de6b Initial load
duke
parents:
diff changeset
   454
     *    DOMSTRING_SIZE_ERR: Raised if the resulting string is too long to
7f561c08de6b Initial load
duke
parents:
diff changeset
   455
     *   fit in a <code>DOMString</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   456
     * @exception LSException
7f561c08de6b Initial load
duke
parents:
diff changeset
   457
     *    SERIALIZE_ERR: Raised if the <code>LSSerializer</code> was unable to
7f561c08de6b Initial load
duke
parents:
diff changeset
   458
     *   serialize the node. DOM applications should attach a
7f561c08de6b Initial load
duke
parents:
diff changeset
   459
     *   <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
7f561c08de6b Initial load
duke
parents:
diff changeset
   460
     *   error-handler</a>" if they wish to get details on the error.
7f561c08de6b Initial load
duke
parents:
diff changeset
   461
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   462
    public String writeToString(Node nodeArg)
7f561c08de6b Initial load
duke
parents:
diff changeset
   463
                                throws DOMException, LSException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   464
7f561c08de6b Initial load
duke
parents:
diff changeset
   465
}