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