View Javadoc
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  
42  package org.w3c.dom.ls;
43  
44  import 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
59  and Save Specification</a>.
60   */
61  public interface DOMImplementationLS {
62      // DOMImplementationLSMode
63      /**
64       * Create a synchronous <code>LSParser</code>.
65       */
66      public static final short MODE_SYNCHRONOUS          = 1;
67      /**
68       * Create an asynchronous <code>LSParser</code>.
69       */
70      public static final short MODE_ASYNCHRONOUS         = 2;
71  
72      /**
73       * Create a new <code>LSParser</code>. The newly constructed parser may
74       * then be configured by means of its <code>DOMConfiguration</code>
75       * object, and used to parse documents by means of its <code>parse</code>
76       *  method.
77       * @param mode  The <code>mode</code> argument is either
78       *   <code>MODE_SYNCHRONOUS</code> or <code>MODE_ASYNCHRONOUS</code>, if
79       *   <code>mode</code> is <code>MODE_SYNCHRONOUS</code> then the
80       *   <code>LSParser</code> that is created will operate in synchronous
81       *   mode, if it's <code>MODE_ASYNCHRONOUS</code> then the
82       *   <code>LSParser</code> that is created will operate in asynchronous
83       *   mode.
84       * @param schemaType  An absolute URI representing the type of the schema
85       *   language used during the load of a <code>Document</code> using the
86       *   newly created <code>LSParser</code>. Note that no lexical checking
87       *   is done on the absolute URI. In order to create a
88       *   <code>LSParser</code> for any kind of schema types (i.e. the
89       *   LSParser will be free to use any schema found), use the value
90       *   <code>null</code>.
91       * <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>]
92       *   , applications must use the value
93       *   <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>],
94       *   applications must use the value
95       *   <code>"http://www.w3.org/TR/REC-xml"</code>. Other Schema languages
96       *   are outside the scope of the W3C and therefore should recommend an
97       *   absolute URI in order to use this method.
98       * @return  The newly created <code>LSParser</code> object. This
99       *   <code>LSParser</code> is either synchronous or asynchronous
100      *   depending on the value of the <code>mode</code> argument.
101      * <p ><b>Note:</b>    By default, the newly created <code>LSParser</code>
102      *   does not contain a <code>DOMErrorHandler</code>, i.e. the value of
103      *   the "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
104      *   error-handler</a>" configuration parameter is <code>null</code>. However, implementations
105      *   may provide a default error handler at creation time. In that case,
106      *   the initial value of the <code>"error-handler"</code> configuration
107      *   parameter on the new <code>LSParser</code> object contains a
108      *   reference to the default error handler.
109      * @exception DOMException
110      *    NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is
111      *   not supported.
112      */
113     public LSParser createLSParser(short mode,
114                                    String schemaType)
115                                    throws DOMException;
116 
117     /**
118      *  Create a new <code>LSSerializer</code> object.
119      * @return The newly created <code>LSSerializer</code> object.
120      * <p ><b>Note:</b>    By default, the newly created
121      *   <code>LSSerializer</code> has no <code>DOMErrorHandler</code>, i.e.
122      *   the value of the <code>"error-handler"</code> configuration
123      *   parameter is <code>null</code>. However, implementations may
124      *   provide a default error handler at creation time. In that case, the
125      *   initial value of the <code>"error-handler"</code> configuration
126      *   parameter on the new <code>LSSerializer</code> object contains a
127      *   reference to the default error handler.
128      */
129     public LSSerializer createLSSerializer();
130 
131     /**
132      *  Create a new empty input source object where
133      * <code>LSInput.characterStream</code>, <code>LSInput.byteStream</code>
134      * , <code>LSInput.stringData</code> <code>LSInput.systemId</code>,
135      * <code>LSInput.publicId</code>, <code>LSInput.baseURI</code>, and
136      * <code>LSInput.encoding</code> are null, and
137      * <code>LSInput.certifiedText</code> is false.
138      * @return  The newly created input object.
139      */
140     public LSInput createLSInput();
141 
142     /**
143      *  Create a new empty output destination object where
144      * <code>LSOutput.characterStream</code>,
145      * <code>LSOutput.byteStream</code>, <code>LSOutput.systemId</code>,
146      * <code>LSOutput.encoding</code> are null.
147      * @return  The newly created output object.
148      */
149     public LSOutput createLSOutput();
150 
151 }