001 /*
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
003 *
004 * This code is free software; you can redistribute it and/or modify it
005 * under the terms of the GNU General Public License version 2 only, as
006 * published by the Free Software Foundation. Sun designates this
007 * particular file as subject to the "Classpath" exception as provided
008 * by Sun in the LICENSE file that accompanied this code.
009 *
010 * This code is distributed in the hope that it will be useful, but WITHOUT
011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
013 * version 2 for more details (a copy is included in the LICENSE file that
014 * accompanied this code).
015 *
016 * You should have received a copy of the GNU General Public License version
017 * 2 along with this work; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
019 *
020 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
021 * CA 95054 USA or visit www.sun.com if you need additional information or
022 * have any questions.
023 */
024
025 /*
026 * This file is available under and governed by the GNU General Public
027 * License version 2 only, as published by the Free Software Foundation.
028 * However, the following notice accompanied the original version of this
029 * file and, per its terms, should not be removed:
030 *
031 * Copyright (c) 2004 World Wide Web Consortium,
032 *
033 * (Massachusetts Institute of Technology, European Research Consortium for
034 * Informatics and Mathematics, Keio University). All Rights Reserved. This
035 * work is distributed under the W3C(r) Software License [1] in the hope that
036 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
037 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
038 *
039 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
040 */
041
042 package org.w3c.dom.ls;
043
044 import org.w3c.dom.Document;
045 import org.w3c.dom.DOMConfiguration;
046 import org.w3c.dom.Node;
047 import org.w3c.dom.DOMException;
048
049 /**
050 * An interface to an object that is able to build, or augment, a DOM tree
051 * from various input sources.
052 * <p> <code>LSParser</code> provides an API for parsing XML and building the
053 * corresponding DOM document structure. A <code>LSParser</code> instance
054 * can be obtained by invoking the
055 * <code>DOMImplementationLS.createLSParser()</code> method.
056 * <p> As specified in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
057 * , when a document is first made available via the LSParser:
058 * <ul>
059 * <li> there will
060 * never be two adjacent nodes of type NODE_TEXT, and there will never be
061 * empty text nodes.
062 * </li>
063 * <li> it is expected that the <code>value</code> and
064 * <code>nodeValue</code> attributes of an <code>Attr</code> node initially
065 * return the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#AVNormalize'>XML 1.0
066 * normalized value</a>. However, if the parameters "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-validate-if-schema'>
067 * validate-if-schema</a>" and "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-datatype-normalization'>
068 * datatype-normalization</a>" are set to <code>true</code>, depending on the attribute normalization
069 * used, the attribute values may differ from the ones obtained by the XML
070 * 1.0 attribute normalization. If the parameters "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-datatype-normalization'>
071 * datatype-normalization</a>" is set to <code>false</code>, the XML 1.0 attribute normalization is
072 * guaranteed to occur, and if the attributes list does not contain
073 * namespace declarations, the <code>attributes</code> attribute on
074 * <code>Element</code> node represents the property <b>[attributes]</b> defined in [<a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204/'>XML Information Set</a>]
075 * .
076 * </li>
077 * </ul>
078 * <p> Asynchronous <code>LSParser</code> objects are expected to also
079 * implement the <code>events::EventTarget</code> interface so that event
080 * listeners can be registered on asynchronous <code>LSParser</code>
081 * objects.
082 * <p> Events supported by asynchronous <code>LSParser</code> objects are:
083 * <dl>
084 * <dt>load</dt>
085 * <dd>
086 * The <code>LSParser</code> finishes to load the document. See also the
087 * definition of the <code>LSLoadEvent</code> interface. </dd>
088 * <dt>progress</dt>
089 * <dd> The
090 * <code>LSParser</code> signals progress as data is parsed. This
091 * specification does not attempt to define exactly when progress events
092 * should be dispatched. That is intentionally left as
093 * implementation-dependent. Here is one example of how an application might
094 * dispatch progress events: Once the parser starts receiving data, a
095 * progress event is dispatched to indicate that the parsing starts. From
096 * there on, a progress event is dispatched for every 4096 bytes of data
097 * that is received and processed. This is only one example, though, and
098 * implementations can choose to dispatch progress events at any time while
099 * parsing, or not dispatch them at all. See also the definition of the
100 * <code>LSProgressEvent</code> interface. </dd>
101 * </dl>
102 * <p ><b>Note:</b> All events defined in this specification use the
103 * namespace URI <code>"http://www.w3.org/2002/DOMLS"</code>.
104 * <p> While parsing an input source, errors are reported to the application
105 * through the error handler (<code>LSParser.domConfig</code>'s "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
106 * error-handler</a>" parameter). This specification does in no way try to define all possible
107 * errors that can occur while parsing XML, or any other markup, but some
108 * common error cases are defined. The types (<code>DOMError.type</code>) of
109 * errors and warnings defined by this specification are:
110 * <dl>
111 * <dt>
112 * <code>"check-character-normalization-failure" [error]</code> </dt>
113 * <dd> Raised if
114 * the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-check-character-normalization'>
115 * check-character-normalization</a>" is set to true and a string is encountered that fails normalization
116 * checking. </dd>
117 * <dt><code>"doctype-not-allowed" [fatal]</code></dt>
118 * <dd> Raised if the
119 * configuration parameter "disallow-doctype" is set to <code>true</code>
120 * and a doctype is encountered. </dd>
121 * <dt><code>"no-input-specified" [fatal]</code></dt>
122 * <dd>
123 * Raised when loading a document and no input is specified in the
124 * <code>LSInput</code> object. </dd>
125 * <dt>
126 * <code>"pi-base-uri-not-preserved" [warning]</code></dt>
127 * <dd> Raised if a processing
128 * instruction is encountered in a location where the base URI of the
129 * processing instruction can not be preserved. One example of a case where
130 * this warning will be raised is if the configuration parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-entities'>
131 * entities</a>" is set to <code>false</code> and the following XML file is parsed:
132 * <pre>
133 * <!DOCTYPE root [ <!ENTITY e SYSTEM 'subdir/myentity.ent' ]>
134 * <root> &e; </root></pre>
135 * And <code>subdir/myentity.ent</code>
136 * contains:
137 * <pre><one> <two/> </one> <?pi 3.14159?>
138 * <more/></pre>
139 * </dd>
140 * <dt><code>"unbound-prefix-in-entity" [warning]</code></dt>
141 * <dd> An
142 * implementation dependent warning that may be raised if the configuration
143 * parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-namespaces'>
144 * namespaces</a>" is set to <code>true</code> and an unbound namespace prefix is
145 * encountered in an entity's replacement text. Raising this warning is not
146 * enforced since some existing parsers may not recognize unbound namespace
147 * prefixes in the replacement text of entities. </dd>
148 * <dt>
149 * <code>"unknown-character-denormalization" [fatal]</code></dt>
150 * <dd> Raised if the
151 * configuration parameter "ignore-unknown-character-denormalizations" is
152 * set to <code>false</code> and a character is encountered for which the
153 * processor cannot determine the normalization properties. </dd>
154 * <dt>
155 * <code>"unsupported-encoding" [fatal]</code></dt>
156 * <dd> Raised if an unsupported
157 * encoding is encountered. </dd>
158 * <dt><code>"unsupported-media-type" [fatal]</code></dt>
159 * <dd>
160 * Raised if the configuration parameter "supported-media-types-only" is set
161 * to <code>true</code> and an unsupported media type is encountered. </dd>
162 * </dl>
163 * <p> In addition to raising the defined errors and warnings, implementations
164 * are expected to raise implementation specific errors and warnings for any
165 * other error and warning cases such as IO errors (file not found,
166 * permission denied,...), XML well-formedness errors, and so on.
167 * <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
168 and Save Specification</a>.
169 */
170 public interface LSParser {
171 /**
172 * The <code>DOMConfiguration</code> object used when parsing an input
173 * source. This <code>DOMConfiguration</code> is specific to the parse
174 * operation. No parameter values from this <code>DOMConfiguration</code>
175 * object are passed automatically to the <code>DOMConfiguration</code>
176 * object on the <code>Document</code> that is created, or used, by the
177 * parse operation. The DOM application is responsible for passing any
178 * needed parameter values from this <code>DOMConfiguration</code>
179 * object to the <code>DOMConfiguration</code> object referenced by the
180 * <code>Document</code> object.
181 * <br> In addition to the parameters recognized in on the <a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMConfiguration'>
182 * DOMConfiguration</a> interface defined in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
183 * , the <code>DOMConfiguration</code> objects for <code>LSParser</code>
184 * add or modify the following parameters:
185 * <dl>
186 * <dt>
187 * <code>"charset-overrides-xml-encoding"</code></dt>
188 * <dd>
189 * <dl>
190 * <dt><code>true</code></dt>
191 * <dd>[<em>optional</em>] (<em>default</em>) If a higher level protocol such as HTTP [<a href='http://www.ietf.org/rfc/rfc2616.txt'>IETF RFC 2616</a>] provides an
192 * indication of the character encoding of the input stream being
193 * processed, that will override any encoding specified in the XML
194 * declaration or the Text declaration (see also section 4.3.3,
195 * "Character Encoding in Entities", in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]).
196 * Explicitly setting an encoding in the <code>LSInput</code> overrides
197 * any encoding from the protocol. </dd>
198 * <dt><code>false</code></dt>
199 * <dd>[<em>required</em>] The parser ignores any character set encoding information from
200 * higher-level protocols. </dd>
201 * </dl></dd>
202 * <dt><code>"disallow-doctype"</code></dt>
203 * <dd>
204 * <dl>
205 * <dt>
206 * <code>true</code></dt>
207 * <dd>[<em>optional</em>] Throw a fatal <b>"doctype-not-allowed"</b> error if a doctype node is found while parsing the document. This is
208 * useful when dealing with things like SOAP envelopes where doctype
209 * nodes are not allowed. </dd>
210 * <dt><code>false</code></dt>
211 * <dd>[<em>required</em>] (<em>default</em>) Allow doctype nodes in the document. </dd>
212 * </dl></dd>
213 * <dt>
214 * <code>"ignore-unknown-character-denormalizations"</code></dt>
215 * <dd>
216 * <dl>
217 * <dt>
218 * <code>true</code></dt>
219 * <dd>[<em>required</em>] (<em>default</em>) If, while verifying full normalization when [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>] is
220 * supported, a processor encounters characters for which it cannot
221 * determine the normalization properties, then the processor will
222 * ignore any possible denormalizations caused by these characters.
223 * This parameter is ignored for [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. </dd>
224 * <dt>
225 * <code>false</code></dt>
226 * <dd>[<em>optional</em>] Report an fatal <b>"unknown-character-denormalization"</b> error if a character is encountered for which the processor cannot
227 * determine the normalization properties. </dd>
228 * </dl></dd>
229 * <dt><code>"infoset"</code></dt>
230 * <dd> See
231 * the definition of <code>DOMConfiguration</code> for a description of
232 * this parameter. Unlike in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
233 * , this parameter will default to <code>true</code> for
234 * <code>LSParser</code>. </dd>
235 * <dt><code>"namespaces"</code></dt>
236 * <dd>
237 * <dl>
238 * <dt><code>true</code></dt>
239 * <dd>[<em>required</em>] (<em>default</em>) Perform the namespace processing as defined in [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
240 * and [<a href='http://www.w3.org/TR/2004/REC-xml-names11-20040204/'>XML Namespaces 1.1</a>]
241 * . </dd>
242 * <dt><code>false</code></dt>
243 * <dd>[<em>optional</em>] Do not perform the namespace processing. </dd>
244 * </dl></dd>
245 * <dt>
246 * <code>"resource-resolver"</code></dt>
247 * <dd>[<em>required</em>] A reference to a <code>LSResourceResolver</code> object, or null. If
248 * the value of this parameter is not null when an external resource
249 * (such as an external XML entity or an XML schema location) is
250 * encountered, the implementation will request that the
251 * <code>LSResourceResolver</code> referenced in this parameter resolves
252 * the resource. </dd>
253 * <dt><code>"supported-media-types-only"</code></dt>
254 * <dd>
255 * <dl>
256 * <dt>
257 * <code>true</code></dt>
258 * <dd>[<em>optional</em>] Check that the media type of the parsed resource is a supported media
259 * type. If an unsupported media type is encountered, a fatal error of
260 * type <b>"unsupported-media-type"</b> will be raised. The media types defined in [<a href='http://www.ietf.org/rfc/rfc3023.txt'>IETF RFC 3023</a>] must always
261 * be accepted. </dd>
262 * <dt><code>false</code></dt>
263 * <dd>[<em>required</em>] (<em>default</em>) Accept any media type. </dd>
264 * </dl></dd>
265 * <dt><code>"validate"</code></dt>
266 * <dd> See the definition of
267 * <code>DOMConfiguration</code> for a description of this parameter.
268 * Unlike in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
269 * , the processing of the internal subset is always accomplished, even
270 * if this parameter is set to <code>false</code>. </dd>
271 * <dt>
272 * <code>"validate-if-schema"</code></dt>
273 * <dd> See the definition of
274 * <code>DOMConfiguration</code> for a description of this parameter.
275 * Unlike in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
276 * , the processing of the internal subset is always accomplished, even
277 * if this parameter is set to <code>false</code>. </dd>
278 * <dt>
279 * <code>"well-formed"</code></dt>
280 * <dd> See the definition of
281 * <code>DOMConfiguration</code> for a description of this parameter.
282 * Unlike in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
283 * , this parameter cannot be set to <code>false</code>. </dd>
284 * </dl>
285 */
286 public DOMConfiguration getDomConfig();
287
288 /**
289 * When a filter is provided, the implementation will call out to the
290 * filter as it is constructing the DOM tree structure. The filter can
291 * choose to remove elements from the document being constructed, or to
292 * terminate the parsing early.
293 * <br> The filter is invoked after the operations requested by the
294 * <code>DOMConfiguration</code> parameters have been applied. For
295 * example, if "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-validate'>
296 * validate</a>" is set to <code>true</code>, the validation is done before invoking the
297 * filter.
298 */
299 public LSParserFilter getFilter();
300
301 /**
302 * When a filter is provided, the implementation will call out to the
303 * filter as it is constructing the DOM tree structure. The filter can
304 * choose to remove elements from the document being constructed, or to
305 * terminate the parsing early.
306 * <br> The filter is invoked after the operations requested by the
307 * <code>DOMConfiguration</code> parameters have been applied. For
308 * example, if "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-validate'>
309 * validate</a>" is set to <code>true</code>, the validation is done before invoking the
310 * filter.
311 */
312 public void setFilter(LSParserFilter filter);
313
314 /**
315 * <code>true</code> if the <code>LSParser</code> is asynchronous,
316 * <code>false</code> if it is synchronous.
317 */
318 public boolean getAsync();
319
320 /**
321 * <code>true</code> if the <code>LSParser</code> is currently busy
322 * loading a document, otherwise <code>false</code>.
323 */
324 public boolean getBusy();
325
326 /**
327 * Parse an XML document from a resource identified by a
328 * <code>LSInput</code>.
329 * @param input The <code>LSInput</code> from which the source of the
330 * document is to be read.
331 * @return If the <code>LSParser</code> is a synchronous
332 * <code>LSParser</code>, the newly created and populated
333 * <code>Document</code> is returned. If the <code>LSParser</code> is
334 * asynchronous, <code>null</code> is returned since the document
335 * object may not yet be constructed when this method returns.
336 * @exception DOMException
337 * INVALID_STATE_ERR: Raised if the <code>LSParser</code>'s
338 * <code>LSParser.busy</code> attribute is <code>true</code>.
339 * @exception LSException
340 * PARSE_ERR: Raised if the <code>LSParser</code> was unable to load
341 * the XML document. DOM applications should attach a
342 * <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
343 * error-handler</a>" if they wish to get details on the error.
344 */
345 public Document parse(LSInput input) throws DOMException,
346 LSException;
347
348 /**
349 * Parse an XML document from a location identified by a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]. If the URI
350 * contains a fragment identifier (see section 4.1 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]), the
351 * behavior is not defined by this specification, future versions of
352 * this specification may define the behavior.
353 * @param uri The location of the XML document to be read.
354 * @return If the <code>LSParser</code> is a synchronous
355 * <code>LSParser</code>, the newly created and populated
356 * <code>Document</code> is returned, or <code>null</code> if an error
357 * occured. If the <code>LSParser</code> is asynchronous,
358 * <code>null</code> is returned since the document object may not yet
359 * be constructed when this method returns.
360 * @exception DOMException
361 * INVALID_STATE_ERR: Raised if the <code>LSParser.busy</code>
362 * attribute is <code>true</code>.
363 * @exception LSException
364 * PARSE_ERR: Raised if the <code>LSParser</code> was unable to load
365 * the XML document. DOM applications should attach a
366 * <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
367 * error-handler</a>" if they wish to get details on the error.
368 */
369 public Document parseURI(String uri) throws DOMException,
370 LSException;
371
372 // ACTION_TYPES
373 /**
374 * Append the result of the parse operation as children of the context
375 * node. For this action to work, the context node must be an
376 * <code>Element</code> or a <code>DocumentFragment</code>.
377 */
378 public static final short ACTION_APPEND_AS_CHILDREN = 1;
379 /**
380 * Replace all the children of the context node with the result of the
381 * parse operation. For this action to work, the context node must be an
382 * <code>Element</code>, a <code>Document</code>, or a
383 * <code>DocumentFragment</code>.
384 */
385 public static final short ACTION_REPLACE_CHILDREN = 2;
386 /**
387 * Insert the result of the parse operation as the immediately preceding
388 * sibling of the context node. For this action to work the context
389 * node's parent must be an <code>Element</code> or a
390 * <code>DocumentFragment</code>.
391 */
392 public static final short ACTION_INSERT_BEFORE = 3;
393 /**
394 * Insert the result of the parse operation as the immediately following
395 * sibling of the context node. For this action to work the context
396 * node's parent must be an <code>Element</code> or a
397 * <code>DocumentFragment</code>.
398 */
399 public static final short ACTION_INSERT_AFTER = 4;
400 /**
401 * Replace the context node with the result of the parse operation. For
402 * this action to work, the context node must have a parent, and the
403 * parent must be an <code>Element</code> or a
404 * <code>DocumentFragment</code>.
405 */
406 public static final short ACTION_REPLACE = 5;
407
408 /**
409 * Parse an XML fragment from a resource identified by a
410 * <code>LSInput</code> and insert the content into an existing document
411 * at the position specified with the <code>context</code> and
412 * <code>action</code> arguments. When parsing the input stream, the
413 * context node (or its parent, depending on where the result will be
414 * inserted) is used for resolving unbound namespace prefixes. The
415 * context node's <code>ownerDocument</code> node (or the node itself if
416 * the node of type <code>DOCUMENT_NODE</code>) is used to resolve
417 * default attributes and entity references.
418 * <br> As the new data is inserted into the document, at least one
419 * mutation event is fired per new immediate child or sibling of the
420 * context node.
421 * <br> If the context node is a <code>Document</code> node and the action
422 * is <code>ACTION_REPLACE_CHILDREN</code>, then the document that is
423 * passed as the context node will be changed such that its
424 * <code>xmlEncoding</code>, <code>documentURI</code>,
425 * <code>xmlVersion</code>, <code>inputEncoding</code>,
426 * <code>xmlStandalone</code>, and all other such attributes are set to
427 * what they would be set to if the input source was parsed using
428 * <code>LSParser.parse()</code>.
429 * <br> This method is always synchronous, even if the
430 * <code>LSParser</code> is asynchronous (<code>LSParser.async</code> is
431 * <code>true</code>).
432 * <br> If an error occurs while parsing, the caller is notified through
433 * the <code>ErrorHandler</code> instance associated with the "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
434 * error-handler</a>" parameter of the <code>DOMConfiguration</code>.
435 * <br> When calling <code>parseWithContext</code>, the values of the
436 * following configuration parameters will be ignored and their default
437 * values will always be used instead: "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-validate'>
438 * validate</a>", "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-validate-if-schema'>
439 * validate-if-schema</a>", and "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-element-content-whitespace'>
440 * element-content-whitespace</a>". Other parameters will be treated normally, and the parser is expected
441 * to call the <code>LSParserFilter</code> just as if a whole document
442 * was parsed.
443 * @param input The <code>LSInput</code> from which the source document
444 * is to be read. The source document must be an XML fragment, i.e.
445 * anything except a complete XML document (except in the case where
446 * the context node of type <code>DOCUMENT_NODE</code>, and the action
447 * is <code>ACTION_REPLACE_CHILDREN</code>), a DOCTYPE (internal
448 * subset), entity declaration(s), notation declaration(s), or XML or
449 * text declaration(s).
450 * @param contextArg The node that is used as the context for the data
451 * that is being parsed. This node must be a <code>Document</code>
452 * node, a <code>DocumentFragment</code> node, or a node of a type
453 * that is allowed as a child of an <code>Element</code> node, e.g. it
454 * cannot be an <code>Attribute</code> node.
455 * @param action This parameter describes which action should be taken
456 * between the new set of nodes being inserted and the existing
457 * children of the context node. The set of possible actions is
458 * defined in <code>ACTION_TYPES</code> above.
459 * @return Return the node that is the result of the parse operation. If
460 * the result is more than one top-level node, the first one is
461 * returned.
462 * @exception DOMException
463 * HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be
464 * inserted before, after, or as a child of the context node (see also
465 * <code>Node.insertBefore</code> or <code>Node.replaceChild</code> in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
466 * ).
467 * <br> NOT_SUPPORTED_ERR: Raised if the <code>LSParser</code> doesn't
468 * support this method, or if the context node is of type
469 * <code>Document</code> and the DOM implementation doesn't support
470 * the replacement of the <code>DocumentType</code> child or
471 * <code>Element</code> child.
472 * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is a
473 * read only node and the content is being appended to its child list,
474 * or if the parent node of the context node is read only node and the
475 * content is being inserted in its child list.
476 * <br> INVALID_STATE_ERR: Raised if the <code>LSParser.busy</code>
477 * attribute is <code>true</code>.
478 * @exception LSException
479 * PARSE_ERR: Raised if the <code>LSParser</code> was unable to load
480 * the XML fragment. DOM applications should attach a
481 * <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
482 * error-handler</a>" if they wish to get details on the error.
483 */
484 public Node parseWithContext(LSInput input, Node contextArg,
485 short action) throws DOMException, LSException;
486
487 /**
488 * Abort the loading of the document that is currently being loaded by
489 * the <code>LSParser</code>. If the <code>LSParser</code> is currently
490 * not busy, a call to this method does nothing.
491 */
492 public void abort();
493
494 }
|