Source Code Cross Referenced for LSSerializer.java in  » 6.0-JDK-Core » w3c » org » w3c » dom » ls » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » w3c » org.w3c.dom.ls 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
003         *
004         * This code is free software; you can redistribute it and/or modify it
005         * under the terms of the GNU General Public License version 2 only, as
006         * published by the Free Software Foundation.  Sun designates this
007         * particular file as subject to the "Classpath" exception as provided
008         * by Sun in the LICENSE file that accompanied this code.
009         *
010         * This code is distributed in the hope that it will be useful, but WITHOUT
011         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
013         * version 2 for more details (a copy is included in the LICENSE file that
014         * accompanied this code).
015         *
016         * You should have received a copy of the GNU General Public License version
017         * 2 along with this work; if not, write to the Free Software Foundation,
018         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
019         *
020         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
021         * CA 95054 USA or visit www.sun.com if you need additional information or
022         * have any questions.
023         */
024
025        /*
026         * This file is available under and governed by the GNU General Public
027         * License version 2 only, as published by the Free Software Foundation.
028         * However, the following notice accompanied the original version of this
029         * file and, per its terms, should not be removed:
030         *
031         * Copyright (c) 2004 World Wide Web Consortium,
032         *
033         * (Massachusetts Institute of Technology, European Research Consortium for
034         * Informatics and Mathematics, Keio University). All Rights Reserved. This
035         * work is distributed under the W3C(r) Software License [1] in the hope that
036         * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
037         * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
038         *
039         * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
040         */
041
042        package org.w3c.dom.ls;
043
044        import org.w3c.dom.DOMConfiguration;
045        import org.w3c.dom.Node;
046        import org.w3c.dom.DOMException;
047
048        /**
049         *  A <code>LSSerializer</code> provides an API for serializing (writing) a 
050         * DOM document out into XML. The XML data is written to a string or an 
051         * output stream. Any changes or fixups made during the serialization affect 
052         * only the serialized data. The <code>Document</code> object and its 
053         * children are never altered by the serialization operation. 
054         * <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>]
055         * , Appendix B. [<a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>DOM Level 2 Core</a>]
056         *  allows empty strings as a real namespace URI. If the 
057         * <code>namespaceURI</code> of a <code>Node</code> is empty string, the 
058         * serialization will treat them as <code>null</code>, ignoring the prefix 
059         * if any. 
060         * <p> <code>LSSerializer</code> accepts any node type for serialization. For 
061         * nodes of type <code>Document</code> or <code>Entity</code>, well-formed 
062         * XML will be created when possible (well-formedness is guaranteed if the 
063         * document or entity comes from a parse operation and is unchanged since it 
064         * was created). The serialized output for these node types is either as a 
065         * XML document or an External XML Entity, respectively, and is acceptable 
066         * input for an XML parser. For all other types of nodes the serialized form 
067         * is implementation dependent. 
068         * <p>Within a <code>Document</code>, <code>DocumentFragment</code>, or 
069         * <code>Entity</code> being serialized, <code>Nodes</code> are processed as 
070         * follows
071         * <ul>
072         * <li> <code>Document</code> nodes are written, including the XML 
073         * declaration (unless the parameter "xml-declaration" is set to 
074         * <code>false</code>) and a DTD subset, if one exists in the DOM. Writing a 
075         * <code>Document</code> node serializes the entire document. 
076         * </li>
077         * <li> 
078         * <code>Entity</code> nodes, when written directly by 
079         * <code>LSSerializer.write</code>, outputs the entity expansion but no 
080         * namespace fixup is done. The resulting output will be valid as an 
081         * external entity. 
082         * </li>
083         * <li> If the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-entities'>
084         * entities</a>" is set to <code>true</code>, <code>EntityReference</code> nodes are 
085         * serialized as an entity reference of the form "
086         * <code>&amp;entityName;</code>" in the output. Child nodes (the expansion) 
087         * of the entity reference are ignored. If the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-entities'>
088         * entities</a>" is set to <code>false</code>, only the children of the entity reference 
089         * are serialized. <code>EntityReference</code> nodes with no children (no 
090         * corresponding <code>Entity</code> node or the corresponding 
091         * <code>Entity</code> nodes have no children) are always serialized. 
092         * </li>
093         * <li> 
094         * <code>CDATAsections</code> containing content characters that cannot be 
095         * represented in the specified output encoding are handled according to the 
096         * "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-split-cdata-sections'>
097         * split-cdata-sections</a>" parameter.  If the parameter is set to <code>true</code>, 
098         * <code>CDATAsections</code> are split, and the unrepresentable characters 
099         * are serialized as numeric character references in ordinary content. The 
100         * exact position and number of splits is not specified.  If the parameter 
101         * is set to <code>false</code>, unrepresentable characters in a 
102         * <code>CDATAsection</code> are reported as 
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'>
104         * well-formed</a>" is set to <code>true</code>. The error is not recoverable - there is no 
105         * mechanism for supplying alternative characters and continuing with the 
106         * serialization. 
107         * </li>
108         * <li> <code>DocumentFragment</code> nodes are serialized by 
109         * serializing the children of the document fragment in the order they 
110         * appear in the document fragment. 
111         * </li>
112         * <li> All other node types (Element, Text, 
113         * etc.) are serialized to their corresponding XML source form. 
114         * </li>
115         * </ul>
116         * <p ><b>Note:</b>  The serialization of a <code>Node</code> does not always 
117         * generate a well-formed XML document, i.e. a <code>LSParser</code> might 
118         * throw fatal errors when parsing the resulting serialization. 
119         * <p> Within the character data of a document (outside of markup), any 
120         * characters that cannot be represented directly are replaced with 
121         * character references. Occurrences of '&lt;' and '&amp;' are replaced by 
122         * the predefined entities &amp;lt; and &amp;amp;. The other predefined 
123         * entities (&amp;gt;, &amp;apos;, and &amp;quot;) might not be used, except 
124         * where needed (e.g. using &amp;gt; in cases such as ']]&gt;'). Any 
125         * characters that cannot be represented directly in the output character 
126         * encoding are serialized as numeric character references (and since 
127         * character encoding standards commonly use hexadecimal representations of 
128         * characters, using the hexadecimal representation when serializing 
129         * character references is encouraged). 
130         * <p> To allow attribute values to contain both single and double quotes, the 
131         * apostrophe or single-quote character (') may be represented as 
132         * "&amp;apos;", and the double-quote character (")  as "&amp;quot;". New 
133         * line characters and other characters that cannot be represented directly 
134         * in attribute values in the output character encoding are serialized as a 
135         * numeric character reference. 
136         * <p> Within markup, but outside of attributes, any occurrence of a character 
137         * that cannot be represented in the output character encoding is reported 
138         * as a <code>DOMError</code> fatal error. An example would be serializing 
139         * the element &lt;LaCa\u00f1ada/&gt; with <code>encoding="us-ascii"</code>. 
140         * This will result with a generation of a <code>DOMError</code> 
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'>
142         * well-formed</a>"). 
143         * <p> When requested by setting the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-normalize-characters'>
144         * normalize-characters</a>" on <code>LSSerializer</code> to true, character normalization is 
145         * performed according to the definition of <a href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully 
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 
147         * data to be serialized, both markup and character data. The character 
148         * normalization process affects only the data as it is being written; it 
149         * does not alter the DOM's view of the document after serialization has 
150         * completed. 
151         * <p> Implementations are required to support the encodings "UTF-8", 
152         * "UTF-16", "UTF-16BE", and "UTF-16LE" to guarantee that data is 
153         * serializable in all encodings that are required to be supported by all 
154         * XML parsers. When the encoding is UTF-8, whether or not a byte order mark 
155         * is serialized, or if the output is big-endian or little-endian, is 
156         * implementation dependent. When the encoding is UTF-16, whether or not the 
157         * output is big-endian or little-endian is implementation dependent, but a 
158         * Byte Order Mark must be generated for non-character outputs, such as 
159         * <code>LSOutput.byteStream</code> or <code>LSOutput.systemId</code>. If 
160         * the Byte Order Mark is not generated, a "byte-order-mark-needed" warning 
161         * is reported. When the encoding is UTF-16LE or UTF-16BE, the output is 
162         * big-endian (UTF-16BE) or little-endian (UTF-16LE) and the Byte Order Mark 
163         * is not be generated. In all cases, the encoding declaration, if 
164         * generated, will correspond to the encoding used during the serialization 
165         * (e.g. <code>encoding="UTF-16"</code> will appear if UTF-16 was 
166         * requested). 
167         * <p> Namespaces are fixed up during serialization, the serialization process 
168         * will verify that namespace declarations, namespace prefixes and the 
169         * namespace URI associated with elements and attributes are consistent. If 
170         * inconsistencies are found, the serialized form of the document will be 
171         * altered to remove them. The method used for doing the namespace fixup 
172         * while serializing a document is the algorithm defined in Appendix B.1, 
173         * "Namespace normalization", of [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
174         * . 
175         * <p> While serializing a document, the parameter "discard-default-content" 
176         * controls whether or not non-specified data is serialized. 
177         * <p> While serializing, errors and warnings are reported to the application 
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'>
179         * error-handler</a>" parameter). This specification does in no way try to define all possible 
180         * errors and warnings that can occur while serializing a DOM node, but some 
181         * common error and warning cases are defined. The types (
182         * <code>DOMError.type</code>) of errors and warnings defined by this 
183         * specification are: 
184         * <dl>
185         * <dt><code>"no-output-specified" [fatal]</code></dt>
186         * <dd> Raised when 
187         * writing to a <code>LSOutput</code> if no output is specified in the 
188         * <code>LSOutput</code>. </dd>
189         * <dt> 
190         * <code>"unbound-prefix-in-entity-reference" [fatal]</code> </dt>
191         * <dd> Raised if the 
192         * configuration parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-namespaces'>
193         * namespaces</a>" is set to <code>true</code> and an entity whose replacement text 
194         * contains unbound namespace prefixes is referenced in a location where 
195         * there are no bindings for the namespace prefixes. </dd>
196         * <dt>
197         * <code>"unsupported-encoding" [fatal]</code></dt>
198         * <dd> Raised if an unsupported 
199         * encoding is encountered. </dd>
200         * </dl> 
201         * <p> In addition to raising the defined errors and warnings, implementations 
202         * are expected to raise implementation specific errors and warnings for any 
203         * other error and warning cases such as IO errors (file not found, 
204         * permission denied,...) and so on. 
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
206         and Save Specification</a>.
207         */
208        public interface LSSerializer {
209            /**
210             *  The <code>DOMConfiguration</code> object used by the 
211             * <code>LSSerializer</code> when serializing a DOM node. 
212             * <br> In addition to the parameters recognized by the <a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMConfiguration'>
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>]
214             * , the <code>DOMConfiguration</code> objects for 
215             * <code>LSSerializer</code> adds, or modifies, the following 
216             * parameters: 
217             * <dl>
218             * <dt><code>"canonical-form"</code></dt>
219             * <dd>
220             * <dl>
221             * <dt><code>true</code></dt>
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>]. 
223             * In addition to the behavior described in "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-canonical-form'>
224             * canonical-form</a>" [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
225             * , setting this parameter to <code>true</code> will set the parameters 
226             * "format-pretty-print", "discard-default-content", and "xml-declaration
227             * ", to <code>false</code>. Setting one of those parameters to 
228             * <code>true</code> will set this parameter to <code>false</code>. 
229             * Serializing an XML 1.1 document when "canonical-form" is 
230             * <code>true</code> will generate a fatal error. </dd>
231             * <dt><code>false</code></dt>
232             * <dd>[<em>required</em>] (<em>default</em>) Do not canonicalize the output. </dd>
233             * </dl></dd>
234             * <dt><code>"discard-default-content"</code></dt>
235             * <dd>
236             * <dl>
237             * <dt>
238             * <code>true</code></dt>
239             * <dd>[<em>required</em>] (<em>default</em>) Use the <code>Attr.specified</code> attribute to decide what attributes 
240             * should be discarded. Note that some implementations might use 
241             * whatever information available to the implementation (i.e. XML 
242             * schema, DTD, the <code>Attr.specified</code> attribute, and so on) to 
243             * determine what attributes and content to discard if this parameter is 
244             * set to <code>true</code>. </dd>
245             * <dt><code>false</code></dt>
246             * <dd>[<em>required</em>]Keep all attributes and all content.</dd>
247             * </dl></dd>
248             * <dt><code>"format-pretty-print"</code></dt>
249             * <dd>
250             * <dl>
251             * <dt>
252             * <code>true</code></dt>
253             * <dd>[<em>optional</em>] Formatting the output by adding whitespace to produce a pretty-printed, 
254             * indented, human-readable form. The exact form of the transformations 
255             * is not specified by this specification. Pretty-printing changes the 
256             * content of the document and may affect the validity of the document, 
257             * validating implementations should preserve validity. </dd>
258             * <dt>
259             * <code>false</code></dt>
260             * <dd>[<em>required</em>] (<em>default</em>) Don't pretty-print the result. </dd>
261             * </dl></dd>
262             * <dt> 
263             * <code>"ignore-unknown-character-denormalizations"</code> </dt>
264             * <dd>
265             * <dl>
266             * <dt>
267             * <code>true</code></dt>
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 
269             * supported, a character is encountered for which the normalization 
270             * properties cannot be determined, then raise a 
271             * <code>"unknown-character-denormalization"</code> warning (instead of 
272             * raising an error, if this parameter is not set) and ignore any 
273             * possible denormalizations caused by these characters. </dd>
274             * <dt>
275             * <code>false</code></dt>
276             * <dd>[<em>optional</em>] Report a fatal error if a character is encountered for which the 
277             * processor cannot determine the normalization properties. </dd>
278             * </dl></dd>
279             * <dt>
280             * <code>"normalize-characters"</code></dt>
281             * <dd> This parameter is equivalent to 
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>]
283             * . Unlike in the Core, the default value for this parameter is 
284             * <code>true</code>. While DOM implementations are not required to 
285             * support <a href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully 
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 
287             * parameter must be activated by default if supported. </dd>
288             * <dt>
289             * <code>"xml-declaration"</code></dt>
290             * <dd>
291             * <dl>
292             * <dt><code>true</code></dt>
293             * <dd>[<em>required</em>] (<em>default</em>) If a <code>Document</code>, <code>Element</code>, or <code>Entity</code>
294             *  node is serialized, the XML declaration, or text declaration, should 
295             * be included. The version (<code>Document.xmlVersion</code> if the 
296             * document is a Level 3 document and the version is non-null, otherwise 
297             * use the value "1.0"), and the output encoding (see 
298             * <code>LSSerializer.write</code> for details on how to find the output 
299             * encoding) are specified in the serialized XML declaration. </dd>
300             * <dt>
301             * <code>false</code></dt>
302             * <dd>[<em>required</em>] Do not serialize the XML and text declarations. Report a 
303             * <code>"xml-declaration-needed"</code> warning if this will cause 
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 
305             * encoding would be needed to be able to re-parse the serialized data). </dd>
306             * </dl></dd>
307             * </dl>
308             */
309            public DOMConfiguration getDomConfig();
310
311            /**
312             *  The end-of-line sequence of characters to be used in the XML being 
313             * written out. Any string is supported, but XML treats only a certain 
314             * set of characters sequence as end-of-line (See section 2.11, 
315             * "End-of-Line Handling" in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>], if the 
316             * serialized content is XML 1.0 or section 2.11, "End-of-Line Handling" 
317             * in [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>], if the 
318             * serialized content is XML 1.1). Using other character sequences than 
319             * the recommended ones can result in a document that is either not 
320             * serializable or not well-formed). 
321             * <br> On retrieval, the default value of this attribute is the 
322             * implementation specific default end-of-line sequence. DOM 
323             * implementations should choose the default to match the usual 
324             * convention for text files in the environment being used. 
325             * Implementations must choose a default sequence that matches one of 
326             * those allowed by XML 1.0 or XML 1.1, depending on the serialized 
327             * content. Setting this attribute to <code>null</code> will reset its 
328             * value to the default value. 
329             * <br> 
330             */
331            public String getNewLine();
332
333            /**
334             *  The end-of-line sequence of characters to be used in the XML being 
335             * written out. Any string is supported, but XML treats only a certain 
336             * set of characters sequence as end-of-line (See section 2.11, 
337             * "End-of-Line Handling" in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>], if the 
338             * serialized content is XML 1.0 or section 2.11, "End-of-Line Handling" 
339             * in [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>], if the 
340             * serialized content is XML 1.1). Using other character sequences than 
341             * the recommended ones can result in a document that is either not 
342             * serializable or not well-formed). 
343             * <br> On retrieval, the default value of this attribute is the 
344             * implementation specific default end-of-line sequence. DOM 
345             * implementations should choose the default to match the usual 
346             * convention for text files in the environment being used. 
347             * Implementations must choose a default sequence that matches one of 
348             * those allowed by XML 1.0 or XML 1.1, depending on the serialized 
349             * content. Setting this attribute to <code>null</code> will reset its 
350             * value to the default value. 
351             * <br> 
352             */
353            public void setNewLine(String newLine);
354
355            /**
356             *  When the application provides a filter, the serializer will call out 
357             * to the filter before serializing each Node. The filter implementation 
358             * can choose to remove the node from the stream or to terminate the 
359             * serialization early. 
360             * <br> The filter is invoked after the operations requested by the 
361             * <code>DOMConfiguration</code> parameters have been applied. For 
362             * 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'>
363             * cdata-sections</a>" is set to <code>false</code>. 
364             */
365            public LSSerializerFilter getFilter();
366
367            /**
368             *  When the application provides a filter, the serializer will call out 
369             * to the filter before serializing each Node. The filter implementation 
370             * can choose to remove the node from the stream or to terminate the 
371             * serialization early. 
372             * <br> The filter is invoked after the operations requested by the 
373             * <code>DOMConfiguration</code> parameters have been applied. For 
374             * 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'>
375             * cdata-sections</a>" is set to <code>false</code>. 
376             */
377            public void setFilter(LSSerializerFilter filter);
378
379            /**
380             *  Serialize the specified node as described above in the general 
381             * description of the <code>LSSerializer</code> interface. The output is 
382             * written to the supplied <code>LSOutput</code>. 
383             * <br> When writing to a <code>LSOutput</code>, the encoding is found by 
384             * looking at the encoding information that is reachable through the 
385             * <code>LSOutput</code> and the item to be written (or its owner 
386             * document) in this order: 
387             * <ol>
388             * <li> <code>LSOutput.encoding</code>, 
389             * </li>
390             * <li> 
391             * <code>Document.inputEncoding</code>, 
392             * </li>
393             * <li> 
394             * <code>Document.xmlEncoding</code>. 
395             * </li>
396             * </ol>
397             * <br> If no encoding is reachable through the above properties, a 
398             * default encoding of "UTF-8" will be used. If the specified encoding 
399             * is not supported an "unsupported-encoding" fatal error is raised. 
400             * <br> If no output is specified in the <code>LSOutput</code>, a 
401             * "no-output-specified" fatal error is raised. 
402             * <br> The implementation is responsible of associating the appropriate 
403             * media type with the serialized data. 
404             * <br> When writing to a HTTP URI, a HTTP PUT is performed. When writing 
405             * to other types of URIs, the mechanism for writing the data to the URI 
406             * is implementation dependent. 
407             * @param nodeArg  The node to serialize. 
408             * @param destination The destination for the serialized DOM.
409             * @return  Returns <code>true</code> if <code>node</code> was 
410             *   successfully serialized. Return <code>false</code> in case the 
411             *   normal processing stopped but the implementation kept serializing 
412             *   the document; the result of the serialization being implementation 
413             *   dependent then. 
414             * @exception LSException
415             *    SERIALIZE_ERR: Raised if the <code>LSSerializer</code> was unable to 
416             *   serialize the node. DOM applications should attach a 
417             *   <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
418             *   error-handler</a>" if they wish to get details on the error. 
419             */
420            public boolean write(Node nodeArg, LSOutput destination)
421                    throws LSException;
422
423            /**
424             *  A convenience method that acts as if <code>LSSerializer.write</code> 
425             * was called with a <code>LSOutput</code> with no encoding specified 
426             * and <code>LSOutput.systemId</code> set to the <code>uri</code> 
427             * argument. 
428             * @param nodeArg  The node to serialize. 
429             * @param uri The URI to write to.
430             * @return  Returns <code>true</code> if <code>node</code> was 
431             *   successfully serialized. Return <code>false</code> in case the 
432             *   normal processing stopped but the implementation kept serializing 
433             *   the document; the result of the serialization being implementation 
434             *   dependent then. 
435             * @exception LSException
436             *    SERIALIZE_ERR: Raised if the <code>LSSerializer</code> was unable to 
437             *   serialize the node. DOM applications should attach a 
438             *   <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
439             *   error-handler</a>" if they wish to get details on the error. 
440             */
441            public boolean writeToURI(Node nodeArg, String uri)
442                    throws LSException;
443
444            /**
445             *  Serialize the specified node as described above in the general 
446             * description of the <code>LSSerializer</code> interface. The output is 
447             * written to a <code>DOMString</code> that is returned to the caller. 
448             * The encoding used is the encoding of the <code>DOMString</code> type, 
449             * i.e. UTF-16. Note that no Byte Order Mark is generated in a 
450             * <code>DOMString</code> object. 
451             * @param nodeArg  The node to serialize. 
452             * @return  Returns the serialized data. 
453             * @exception DOMException
454             *    DOMSTRING_SIZE_ERR: Raised if the resulting string is too long to 
455             *   fit in a <code>DOMString</code>. 
456             * @exception LSException
457             *    SERIALIZE_ERR: Raised if the <code>LSSerializer</code> was unable to 
458             *   serialize the node. DOM applications should attach a 
459             *   <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
460             *   error-handler</a>" if they wish to get details on the error. 
461             */
462            public String writeToString(Node nodeArg) throws DOMException,
463                    LSException;
464
465        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.