1320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson/* 2320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Copyright (c) 2004 World Wide Web Consortium, 3320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * 4320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * (Massachusetts Institute of Technology, European Research Consortium for 5320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Informatics and Mathematics, Keio University). All Rights Reserved. This 6320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * work is distributed under the W3C(r) Software License [1] in the hope that 7320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 8320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * 10320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 11320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 12320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 13320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilsonpackage org.w3c.dom.ls; 14320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 15320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilsonimport org.w3c.dom.DOMException; 16320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 17320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson/** 18f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMImplementationLS</code> contains the factory methods for creating 19f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Load and Save objects. 20f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p> The expectation is that an instance of the 21f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMImplementationLS</code> interface can be obtained by using 22f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * binding-specific casting methods on an instance of the 23f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMImplementation</code> interface or, if the <code>Document</code> 24f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * supports the feature <code>"Core"</code> version <code>"3.0"</code> 25320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * defined in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>] 26f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , by using the method <code>DOMImplementation.getFeature</code> with 27f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * parameter values <code>"LS"</code> (or <code>"LS-Async"</code>) and 28f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>"3.0"</code> (respectively). 29320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <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 30320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilsonand Save Specification</a>. 31320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 32320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilsonpublic interface DOMImplementationLS { 33320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson // DOMImplementationLSMode 34320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 35320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Create a synchronous <code>LSParser</code>. 36320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 37320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public static final short MODE_SYNCHRONOUS = 1; 38320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 39320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Create an asynchronous <code>LSParser</code>. 40320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 41320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public static final short MODE_ASYNCHRONOUS = 2; 42320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 43320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 44f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Create a new <code>LSParser</code>. The newly constructed parser may 45f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * then be configured by means of its <code>DOMConfiguration</code> 46320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * object, and used to parse documents by means of its <code>parse</code> 47f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * method. 48f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param mode The <code>mode</code> argument is either 49f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>MODE_SYNCHRONOUS</code> or <code>MODE_ASYNCHRONOUS</code>, if 50f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>mode</code> is <code>MODE_SYNCHRONOUS</code> then the 51f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSParser</code> that is created will operate in synchronous 52f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * mode, if it's <code>MODE_ASYNCHRONOUS</code> then the 53f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSParser</code> that is created will operate in asynchronous 54f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * mode. 55f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param schemaType An absolute URI representing the type of the schema 56f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * language used during the load of a <code>Document</code> using the 57f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * newly created <code>LSParser</code>. Note that no lexical checking 58f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * is done on the absolute URI. In order to create a 59f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSParser</code> for any kind of schema types (i.e. the 60f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * LSParser will be free to use any schema found), use the value 61f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>null</code>. 62320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <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>] 63f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , applications must use the value 64f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <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>], 65f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * applications must use the value 66f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>"http://www.w3.org/TR/REC-xml"</code>. Other Schema languages 67f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * are outside the scope of the W3C and therefore should recommend an 68f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * absolute URI in order to use this method. 69f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return The newly created <code>LSParser</code> object. This 70f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSParser</code> is either synchronous or asynchronous 71f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * depending on the value of the <code>mode</code> argument. 72f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p ><b>Note:</b> By default, the newly created <code>LSParser</code> 73f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * does not contain a <code>DOMErrorHandler</code>, i.e. the value of 74320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * the "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'> 75f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * error-handler</a>" configuration parameter is <code>null</code>. However, implementations 76f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * may provide a default error handler at creation time. In that case, 77f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the initial value of the <code>"error-handler"</code> configuration 78f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * parameter on the new <code>LSParser</code> object contains a 79f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * reference to the default error handler. 80320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @exception DOMException 81f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is 82f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * not supported. 83320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 84f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes public LSParser createLSParser(short mode, 85320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson String schemaType) 86320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson throws DOMException; 87320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 88320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 89f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Create a new <code>LSSerializer</code> object. 90320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @return The newly created <code>LSSerializer</code> object. 91f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p ><b>Note:</b> By default, the newly created 92f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSSerializer</code> has no <code>DOMErrorHandler</code>, i.e. 93f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the value of the <code>"error-handler"</code> configuration 94f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * parameter is <code>null</code>. However, implementations may 95f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * provide a default error handler at creation time. In that case, the 96f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * initial value of the <code>"error-handler"</code> configuration 97f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * parameter on the new <code>LSSerializer</code> object contains a 98f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * reference to the default error handler. 99320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 100320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public LSSerializer createLSSerializer(); 101320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 102320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 103f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Create a new empty input source object where 104320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>LSInput.characterStream</code>, <code>LSInput.byteStream</code> 105f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , <code>LSInput.stringData</code> <code>LSInput.systemId</code>, 106f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSInput.publicId</code>, <code>LSInput.baseURI</code>, and 107f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSInput.encoding</code> are null, and 108f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSInput.certifiedText</code> is false. 109f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return The newly created input object. 110320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 111320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public LSInput createLSInput(); 112320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 113320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 114f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Create a new empty output destination object where 115f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSOutput.characterStream</code>, 116f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSOutput.byteStream</code>, <code>LSOutput.systemId</code>, 117f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSOutput.encoding</code> are null. 118f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return The newly created output object. 119320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 120320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public LSOutput createLSOutput(); 121320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 122320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson} 123