1/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.  Oracle designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25/*
26 * This file is available under and governed by the GNU General Public
27 * License version 2 only, as published by the Free Software Foundation.
28 * However, the following notice accompanied the original version of this
29 * file and, per its terms, should not be removed:
30 *
31 * Copyright (c) 2004 World Wide Web Consortium,
32 *
33 * (Massachusetts Institute of Technology, European Research Consortium for
34 * Informatics and Mathematics, Keio University). All Rights Reserved. This
35 * work is distributed under the W3C(r) Software License [1] in the hope that
36 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
37 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
38 *
39 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
40 */
41
42package org.w3c.dom.ls;
43
44import org.w3c.dom.DOMException;
45
46/**
47 *  <code>DOMImplementationLS</code> contains the factory methods for creating
48 * Load and Save objects.
49 * <p> The expectation is that an instance of the
50 * <code>DOMImplementationLS</code> interface can be obtained by using
51 * binding-specific casting methods on an instance of the
52 * <code>DOMImplementation</code> interface or, if the <code>Document</code>
53 * supports the feature <code>"Core"</code> version <code>"3.0"</code>
54 * defined in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
55 * , by using the method <code>DOMImplementation.getFeature</code> with
56 * parameter values <code>"LS"</code> (or <code>"LS-Async"</code>) and
57 * <code>"3.0"</code> (respectively).
58 * <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
59and Save Specification</a>.
60 *
61 * @since 1.5
62 */
63public interface DOMImplementationLS {
64    // DOMImplementationLSMode
65    /**
66     * Create a synchronous <code>LSParser</code>.
67     */
68    public static final short MODE_SYNCHRONOUS          = 1;
69    /**
70     * Create an asynchronous <code>LSParser</code>.
71     */
72    public static final short MODE_ASYNCHRONOUS         = 2;
73
74    /**
75     * Create a new <code>LSParser</code>. The newly constructed parser may
76     * then be configured by means of its <code>DOMConfiguration</code>
77     * object, and used to parse documents by means of its <code>parse</code>
78     *  method.
79     * @param mode  The <code>mode</code> argument is either
80     *   <code>MODE_SYNCHRONOUS</code> or <code>MODE_ASYNCHRONOUS</code>, if
81     *   <code>mode</code> is <code>MODE_SYNCHRONOUS</code> then the
82     *   <code>LSParser</code> that is created will operate in synchronous
83     *   mode, if it's <code>MODE_ASYNCHRONOUS</code> then the
84     *   <code>LSParser</code> that is created will operate in asynchronous
85     *   mode.
86     * @param schemaType  An absolute URI representing the type of the schema
87     *   language used during the load of a <code>Document</code> using the
88     *   newly created <code>LSParser</code>. Note that no lexical checking
89     *   is done on the absolute URI. In order to create a
90     *   <code>LSParser</code> for any kind of schema types (i.e. the
91     *   LSParser will be free to use any schema found), use the value
92     *   <code>null</code>.
93     * <p ><b>Note:</b>    For W3C XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
94     *   , applications must use the value
95     *   <code>"http://www.w3.org/2001/XMLSchema"</code>. For XML DTD [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>],
96     *   applications must use the value
97     *   <code>"http://www.w3.org/TR/REC-xml"</code>. Other Schema languages
98     *   are outside the scope of the W3C and therefore should recommend an
99     *   absolute URI in order to use this method.
100     * @return  The newly created <code>LSParser</code> object. This
101     *   <code>LSParser</code> is either synchronous or asynchronous
102     *   depending on the value of the <code>mode</code> argument.
103     * <p ><b>Note:</b>    By default, the newly created <code>LSParser</code>
104     *   does not contain a <code>DOMErrorHandler</code>, i.e. the value of
105     *   the "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
106     *   error-handler</a>" configuration parameter is <code>null</code>. However, implementations
107     *   may provide a default error handler at creation time. In that case,
108     *   the initial value of the <code>"error-handler"</code> configuration
109     *   parameter on the new <code>LSParser</code> object contains a
110     *   reference to the default error handler.
111     * @exception DOMException
112     *    NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is
113     *   not supported.
114     */
115    public LSParser createLSParser(short mode,
116                                   String schemaType)
117                                   throws DOMException;
118
119    /**
120     *  Create a new <code>LSSerializer</code> object.
121     * @return The newly created <code>LSSerializer</code> object.
122     * <p ><b>Note:</b>    By default, the newly created
123     *   <code>LSSerializer</code> has no <code>DOMErrorHandler</code>, i.e.
124     *   the value of the <code>"error-handler"</code> configuration
125     *   parameter is <code>null</code>. However, implementations may
126     *   provide a default error handler at creation time. In that case, the
127     *   initial value of the <code>"error-handler"</code> configuration
128     *   parameter on the new <code>LSSerializer</code> object contains a
129     *   reference to the default error handler.
130     */
131    public LSSerializer createLSSerializer();
132
133    /**
134     *  Create a new empty input source object where
135     * <code>LSInput.characterStream</code>, <code>LSInput.byteStream</code>
136     * , <code>LSInput.stringData</code> <code>LSInput.systemId</code>,
137     * <code>LSInput.publicId</code>, <code>LSInput.baseURI</code>, and
138     * <code>LSInput.encoding</code> are null, and
139     * <code>LSInput.certifiedText</code> is false.
140     * @return  The newly created input object.
141     */
142    public LSInput createLSInput();
143
144    /**
145     *  Create a new empty output destination object where
146     * <code>LSOutput.characterStream</code>,
147     * <code>LSOutput.byteStream</code>, <code>LSOutput.systemId</code>,
148     * <code>LSOutput.encoding</code> are null.
149     * @return  The newly created output object.
150     */
151    public LSOutput createLSOutput();
152
153}
154