1 /*
2  * Copyright (c) 2004 World Wide Web Consortium,
3  *
4  * (Massachusetts Institute of Technology, European Research Consortium for
5  * Informatics and Mathematics, Keio University). All Rights Reserved. This
6  * work is distributed under the W3C(r) Software License [1] in the hope that
7  * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9  *
10  * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11  */
12 
13 package org.w3c.dom.ls;
14 
15 import org.w3c.dom.DOMException;
16 
17 /**
18  *  <code>DOMImplementationLS</code> contains the factory methods for creating
19  * Load and Save objects.
20  * <p> The expectation is that an instance of the
21  * <code>DOMImplementationLS</code> interface can be obtained by using
22  * binding-specific casting methods on an instance of the
23  * <code>DOMImplementation</code> interface or, if the <code>Document</code>
24  * supports the feature <code>"Core"</code> version <code>"3.0"</code>
25  * defined in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
26  * , by using the method <code>DOMImplementation.getFeature</code> with
27  * parameter values <code>"LS"</code> (or <code>"LS-Async"</code>) and
28  * <code>"3.0"</code> (respectively).
29  * <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
30 and Save Specification</a>.
31  */
32 public interface DOMImplementationLS {
33     // DOMImplementationLSMode
34     /**
35      * Create a synchronous <code>LSParser</code>.
36      */
37     public static final short MODE_SYNCHRONOUS          = 1;
38     /**
39      * Create an asynchronous <code>LSParser</code>.
40      */
41     public static final short MODE_ASYNCHRONOUS         = 2;
42 
43     /**
44      * Create a new <code>LSParser</code>. The newly constructed parser may
45      * then be configured by means of its <code>DOMConfiguration</code>
46      * object, and used to parse documents by means of its <code>parse</code>
47      *  method.
48      * @param mode  The <code>mode</code> argument is either
49      *   <code>MODE_SYNCHRONOUS</code> or <code>MODE_ASYNCHRONOUS</code>, if
50      *   <code>mode</code> is <code>MODE_SYNCHRONOUS</code> then the
51      *   <code>LSParser</code> that is created will operate in synchronous
52      *   mode, if it's <code>MODE_ASYNCHRONOUS</code> then the
53      *   <code>LSParser</code> that is created will operate in asynchronous
54      *   mode.
55      * @param schemaType  An absolute URI representing the type of the schema
56      *   language used during the load of a <code>Document</code> using the
57      *   newly created <code>LSParser</code>. Note that no lexical checking
58      *   is done on the absolute URI. In order to create a
59      *   <code>LSParser</code> for any kind of schema types (i.e. the
60      *   LSParser will be free to use any schema found), use the value
61      *   <code>null</code>.
62      * <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>]
63      *   , applications must use the value
64      *   <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>],
65      *   applications must use the value
66      *   <code>"http://www.w3.org/TR/REC-xml"</code>. Other Schema languages
67      *   are outside the scope of the W3C and therefore should recommend an
68      *   absolute URI in order to use this method.
69      * @return  The newly created <code>LSParser</code> object. This
70      *   <code>LSParser</code> is either synchronous or asynchronous
71      *   depending on the value of the <code>mode</code> argument.
72      * <p ><b>Note:</b>    By default, the newly created <code>LSParser</code>
73      *   does not contain a <code>DOMErrorHandler</code>, i.e. the value of
74      *   the "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
75      *   error-handler</a>" configuration parameter is <code>null</code>. However, implementations
76      *   may provide a default error handler at creation time. In that case,
77      *   the initial value of the <code>"error-handler"</code> configuration
78      *   parameter on the new <code>LSParser</code> object contains a
79      *   reference to the default error handler.
80      * @exception DOMException
81      *    NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is
82      *   not supported.
83      */
createLSParser(short mode, String schemaType)84     public LSParser createLSParser(short mode,
85                                    String schemaType)
86                                    throws DOMException;
87 
88     /**
89      *  Create a new <code>LSSerializer</code> object.
90      * @return The newly created <code>LSSerializer</code> object.
91      * <p ><b>Note:</b>    By default, the newly created
92      *   <code>LSSerializer</code> has no <code>DOMErrorHandler</code>, i.e.
93      *   the value of the <code>"error-handler"</code> configuration
94      *   parameter is <code>null</code>. However, implementations may
95      *   provide a default error handler at creation time. In that case, the
96      *   initial value of the <code>"error-handler"</code> configuration
97      *   parameter on the new <code>LSSerializer</code> object contains a
98      *   reference to the default error handler.
99      */
createLSSerializer()100     public LSSerializer createLSSerializer();
101 
102     /**
103      *  Create a new empty input source object where
104      * <code>LSInput.characterStream</code>, <code>LSInput.byteStream</code>
105      * , <code>LSInput.stringData</code> <code>LSInput.systemId</code>,
106      * <code>LSInput.publicId</code>, <code>LSInput.baseURI</code>, and
107      * <code>LSInput.encoding</code> are null, and
108      * <code>LSInput.certifiedText</code> is false.
109      * @return  The newly created input object.
110      */
createLSInput()111     public LSInput createLSInput();
112 
113     /**
114      *  Create a new empty output destination object where
115      * <code>LSOutput.characterStream</code>,
116      * <code>LSOutput.byteStream</code>, <code>LSOutput.systemId</code>,
117      * <code>LSOutput.encoding</code> are null.
118      * @return  The newly created output object.
119      */
createLSOutput()120     public LSOutput createLSOutput();
121 
122 }
123