001/*
002 * Copyright (c) 2004 World Wide Web Consortium,
003 *
004 * (Massachusetts Institute of Technology, European Research Consortium for
005 * Informatics and Mathematics, Keio University). All Rights Reserved. This
006 * work is distributed under the W3C(r) Software License [1] in the hope that
007 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
008 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
009 *
010 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
011 */
012
013package org.w3c.dom.ls;
014
015import org.w3c.dom.DOMException;
016
017/**
018 *  <code>DOMImplementationLS</code> contains the factory methods for creating 
019 * Load and Save objects. 
020 * <p> The expectation is that an instance of the 
021 * <code>DOMImplementationLS</code> interface can be obtained by using 
022 * binding-specific casting methods on an instance of the 
023 * <code>DOMImplementation</code> interface or, if the <code>Document</code> 
024 * supports the feature <code>"Core"</code> version <code>"3.0"</code> 
025 * defined in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
026 * , by using the method <code>DOMImplementation.getFeature</code> with 
027 * parameter values <code>"LS"</code> (or <code>"LS-Async"</code>) and 
028 * <code>"3.0"</code> (respectively). 
029 * <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
030and Save Specification</a>.
031 */
032public interface DOMImplementationLS {
033    // DOMImplementationLSMode
034    /**
035     * Create a synchronous <code>LSParser</code>.
036     */
037    public static final short MODE_SYNCHRONOUS          = 1;
038    /**
039     * Create an asynchronous <code>LSParser</code>.
040     */
041    public static final short MODE_ASYNCHRONOUS         = 2;
042
043    /**
044     * Create a new <code>LSParser</code>. The newly constructed parser may 
045     * then be configured by means of its <code>DOMConfiguration</code> 
046     * object, and used to parse documents by means of its <code>parse</code>
047     *  method. 
048     * @param mode  The <code>mode</code> argument is either 
049     *   <code>MODE_SYNCHRONOUS</code> or <code>MODE_ASYNCHRONOUS</code>, if 
050     *   <code>mode</code> is <code>MODE_SYNCHRONOUS</code> then the 
051     *   <code>LSParser</code> that is created will operate in synchronous 
052     *   mode, if it's <code>MODE_ASYNCHRONOUS</code> then the 
053     *   <code>LSParser</code> that is created will operate in asynchronous 
054     *   mode. 
055     * @param schemaType  An absolute URI representing the type of the schema 
056     *   language used during the load of a <code>Document</code> using the 
057     *   newly created <code>LSParser</code>. Note that no lexical checking 
058     *   is done on the absolute URI. In order to create a 
059     *   <code>LSParser</code> for any kind of schema types (i.e. the 
060     *   LSParser will be free to use any schema found), use the value 
061     *   <code>null</code>. 
062     * <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>]
063     *   , applications must use the value 
064     *   <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>], 
065     *   applications must use the value 
066     *   <code>"http://www.w3.org/TR/REC-xml"</code>. Other Schema languages 
067     *   are outside the scope of the W3C and therefore should recommend an 
068     *   absolute URI in order to use this method. 
069     * @return  The newly created <code>LSParser</code> object. This 
070     *   <code>LSParser</code> is either synchronous or asynchronous 
071     *   depending on the value of the <code>mode</code> argument. 
072     * <p ><b>Note:</b>    By default, the newly created <code>LSParser</code> 
073     *   does not contain a <code>DOMErrorHandler</code>, i.e. the value of 
074     *   the "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
075     *   error-handler</a>" configuration parameter is <code>null</code>. However, implementations 
076     *   may provide a default error handler at creation time. In that case, 
077     *   the initial value of the <code>"error-handler"</code> configuration 
078     *   parameter on the new <code>LSParser</code> object contains a 
079     *   reference to the default error handler. 
080     * @exception DOMException
081     *    NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is 
082     *   not supported. 
083     */
084    public LSParser createLSParser(short mode, 
085                                   String schemaType)
086                                   throws DOMException;
087
088    /**
089     *  Create a new <code>LSSerializer</code> object. 
090     * @return The newly created <code>LSSerializer</code> object.
091     * <p ><b>Note:</b>    By default, the newly created 
092     *   <code>LSSerializer</code> has no <code>DOMErrorHandler</code>, i.e. 
093     *   the value of the <code>"error-handler"</code> configuration 
094     *   parameter is <code>null</code>. However, implementations may 
095     *   provide a default error handler at creation time. In that case, the 
096     *   initial value of the <code>"error-handler"</code> configuration 
097     *   parameter on the new <code>LSSerializer</code> object contains a 
098     *   reference to the default error handler. 
099     */
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     */
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     */
120    public LSOutput createLSOutput();
121
122}