Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/w3c/dom/ls/LSParser.java
86410 views
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.Document;
45
import org.w3c.dom.DOMConfiguration;
46
import org.w3c.dom.Node;
47
import org.w3c.dom.DOMException;
48
49
/**
50
* An interface to an object that is able to build, or augment, a DOM tree
51
* from various input sources.
52
* <p> <code>LSParser</code> provides an API for parsing XML and building the
53
* corresponding DOM document structure. A <code>LSParser</code> instance
54
* can be obtained by invoking the
55
* <code>DOMImplementationLS.createLSParser()</code> method.
56
* <p> As specified in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
57
* , when a document is first made available via the LSParser:
58
* <ul>
59
* <li> there will
60
* never be two adjacent nodes of type NODE_TEXT, and there will never be
61
* empty text nodes.
62
* </li>
63
* <li> it is expected that the <code>value</code> and
64
* <code>nodeValue</code> attributes of an <code>Attr</code> node initially
65
* return the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#AVNormalize'>XML 1.0
66
* normalized value</a>. However, if the parameters "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-validate-if-schema'>
67
* validate-if-schema</a>" and "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-datatype-normalization'>
68
* datatype-normalization</a>" are set to <code>true</code>, depending on the attribute normalization
69
* used, the attribute values may differ from the ones obtained by the XML
70
* 1.0 attribute normalization. If the parameters "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-datatype-normalization'>
71
* datatype-normalization</a>" is set to <code>false</code>, the XML 1.0 attribute normalization is
72
* guaranteed to occur, and if the attributes list does not contain
73
* namespace declarations, the <code>attributes</code> attribute on
74
* <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>]
75
* .
76
* </li>
77
* </ul>
78
* <p> Asynchronous <code>LSParser</code> objects are expected to also
79
* implement the <code>events::EventTarget</code> interface so that event
80
* listeners can be registered on asynchronous <code>LSParser</code>
81
* objects.
82
* <p> Events supported by asynchronous <code>LSParser</code> objects are:
83
* <dl>
84
* <dt>load</dt>
85
* <dd>
86
* The <code>LSParser</code> finishes to load the document. See also the
87
* definition of the <code>LSLoadEvent</code> interface. </dd>
88
* <dt>progress</dt>
89
* <dd> The
90
* <code>LSParser</code> signals progress as data is parsed. This
91
* specification does not attempt to define exactly when progress events
92
* should be dispatched. That is intentionally left as
93
* implementation-dependent. Here is one example of how an application might
94
* dispatch progress events: Once the parser starts receiving data, a
95
* progress event is dispatched to indicate that the parsing starts. From
96
* there on, a progress event is dispatched for every 4096 bytes of data
97
* that is received and processed. This is only one example, though, and
98
* implementations can choose to dispatch progress events at any time while
99
* 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
* &lt;!DOCTYPE root [ &lt;!ENTITY e SYSTEM 'subdir/myentity.ent' ]&gt;
134
* &lt;root&gt; &amp;e; &lt;/root&gt;</pre>
135
* And <code>subdir/myentity.ent</code>
136
* contains:
137
* <pre>&lt;one&gt; &lt;two/&gt; &lt;/one&gt; &lt;?pi 3.14159?&gt;
138
* &lt;more/&gt;</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
* When a filter is provided, the implementation will call out to the
302
* filter as it is constructing the DOM tree structure. The filter can
303
* choose to remove elements from the document being constructed, or to
304
* terminate the parsing early.
305
* <br> The filter is invoked after the operations requested by the
306
* <code>DOMConfiguration</code> parameters have been applied. For
307
* example, if "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-validate'>
308
* validate</a>" is set to <code>true</code>, the validation is done before invoking the
309
* filter.
310
*/
311
public void setFilter(LSParserFilter filter);
312
313
/**
314
* <code>true</code> if the <code>LSParser</code> is asynchronous,
315
* <code>false</code> if it is synchronous.
316
*/
317
public boolean getAsync();
318
319
/**
320
* <code>true</code> if the <code>LSParser</code> is currently busy
321
* loading a document, otherwise <code>false</code>.
322
*/
323
public boolean getBusy();
324
325
/**
326
* Parse an XML document from a resource identified by a
327
* <code>LSInput</code>.
328
* @param input The <code>LSInput</code> from which the source of the
329
* document is to be read.
330
* @return If the <code>LSParser</code> is a synchronous
331
* <code>LSParser</code>, the newly created and populated
332
* <code>Document</code> is returned. If the <code>LSParser</code> is
333
* asynchronous, <code>null</code> is returned since the document
334
* object may not yet be constructed when this method returns.
335
* @exception DOMException
336
* INVALID_STATE_ERR: Raised if the <code>LSParser</code>'s
337
* <code>LSParser.busy</code> attribute is <code>true</code>.
338
* @exception LSException
339
* PARSE_ERR: Raised if the <code>LSParser</code> was unable to load
340
* the XML document. DOM applications should attach a
341
* <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
342
* error-handler</a>" if they wish to get details on the error.
343
*/
344
public Document parse(LSInput input)
345
throws DOMException, LSException;
346
347
/**
348
* 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
349
* contains a fragment identifier (see section 4.1 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]), the
350
* behavior is not defined by this specification, future versions of
351
* this specification may define the behavior.
352
* @param uri The location of the XML document to be read.
353
* @return If the <code>LSParser</code> is a synchronous
354
* <code>LSParser</code>, the newly created and populated
355
* <code>Document</code> is returned, or <code>null</code> if an error
356
* occured. If the <code>LSParser</code> is asynchronous,
357
* <code>null</code> is returned since the document object may not yet
358
* be constructed when this method returns.
359
* @exception DOMException
360
* INVALID_STATE_ERR: Raised if the <code>LSParser.busy</code>
361
* attribute is <code>true</code>.
362
* @exception LSException
363
* PARSE_ERR: Raised if the <code>LSParser</code> was unable to load
364
* the XML document. DOM applications should attach a
365
* <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
366
* error-handler</a>" if they wish to get details on the error.
367
*/
368
public Document parseURI(String uri)
369
throws DOMException, LSException;
370
371
// ACTION_TYPES
372
/**
373
* Append the result of the parse operation as children of the context
374
* node. For this action to work, the context node must be an
375
* <code>Element</code> or a <code>DocumentFragment</code>.
376
*/
377
public static final short ACTION_APPEND_AS_CHILDREN = 1;
378
/**
379
* Replace all the children of the context node with the result of the
380
* parse operation. For this action to work, the context node must be an
381
* <code>Element</code>, a <code>Document</code>, or a
382
* <code>DocumentFragment</code>.
383
*/
384
public static final short ACTION_REPLACE_CHILDREN = 2;
385
/**
386
* Insert the result of the parse operation as the immediately preceding
387
* sibling of the context node. For this action to work the context
388
* node's parent must be an <code>Element</code> or a
389
* <code>DocumentFragment</code>.
390
*/
391
public static final short ACTION_INSERT_BEFORE = 3;
392
/**
393
* Insert the result of the parse operation as the immediately following
394
* sibling of the context node. For this action to work the context
395
* node's parent must be an <code>Element</code> or a
396
* <code>DocumentFragment</code>.
397
*/
398
public static final short ACTION_INSERT_AFTER = 4;
399
/**
400
* Replace the context node with the result of the parse operation. For
401
* this action to work, the context node must have a parent, and the
402
* parent must be an <code>Element</code> or a
403
* <code>DocumentFragment</code>.
404
*/
405
public static final short ACTION_REPLACE = 5;
406
407
/**
408
* Parse an XML fragment from a resource identified by a
409
* <code>LSInput</code> and insert the content into an existing document
410
* at the position specified with the <code>context</code> and
411
* <code>action</code> arguments. When parsing the input stream, the
412
* context node (or its parent, depending on where the result will be
413
* inserted) is used for resolving unbound namespace prefixes. The
414
* context node's <code>ownerDocument</code> node (or the node itself if
415
* the node of type <code>DOCUMENT_NODE</code>) is used to resolve
416
* default attributes and entity references.
417
* <br> As the new data is inserted into the document, at least one
418
* mutation event is fired per new immediate child or sibling of the
419
* context node.
420
* <br> If the context node is a <code>Document</code> node and the action
421
* is <code>ACTION_REPLACE_CHILDREN</code>, then the document that is
422
* passed as the context node will be changed such that its
423
* <code>xmlEncoding</code>, <code>documentURI</code>,
424
* <code>xmlVersion</code>, <code>inputEncoding</code>,
425
* <code>xmlStandalone</code>, and all other such attributes are set to
426
* what they would be set to if the input source was parsed using
427
* <code>LSParser.parse()</code>.
428
* <br> This method is always synchronous, even if the
429
* <code>LSParser</code> is asynchronous (<code>LSParser.async</code> is
430
* <code>true</code>).
431
* <br> If an error occurs while parsing, the caller is notified through
432
* the <code>ErrorHandler</code> instance associated with the "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
433
* error-handler</a>" parameter of the <code>DOMConfiguration</code>.
434
* <br> When calling <code>parseWithContext</code>, the values of the
435
* following configuration parameters will be ignored and their default
436
* values will always be used instead: "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-validate'>
437
* validate</a>", "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-validate-if-schema'>
438
* validate-if-schema</a>", and "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-element-content-whitespace'>
439
* element-content-whitespace</a>". Other parameters will be treated normally, and the parser is expected
440
* to call the <code>LSParserFilter</code> just as if a whole document
441
* was parsed.
442
* @param input The <code>LSInput</code> from which the source document
443
* is to be read. The source document must be an XML fragment, i.e.
444
* anything except a complete XML document (except in the case where
445
* the context node of type <code>DOCUMENT_NODE</code>, and the action
446
* is <code>ACTION_REPLACE_CHILDREN</code>), a DOCTYPE (internal
447
* subset), entity declaration(s), notation declaration(s), or XML or
448
* text declaration(s).
449
* @param contextArg The node that is used as the context for the data
450
* that is being parsed. This node must be a <code>Document</code>
451
* node, a <code>DocumentFragment</code> node, or a node of a type
452
* that is allowed as a child of an <code>Element</code> node, e.g. it
453
* cannot be an <code>Attribute</code> node.
454
* @param action This parameter describes which action should be taken
455
* between the new set of nodes being inserted and the existing
456
* children of the context node. The set of possible actions is
457
* defined in <code>ACTION_TYPES</code> above.
458
* @return Return the node that is the result of the parse operation. If
459
* the result is more than one top-level node, the first one is
460
* returned.
461
* @exception DOMException
462
* HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be
463
* inserted before, after, or as a child of the context node (see also
464
* <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>]
465
* ).
466
* <br> NOT_SUPPORTED_ERR: Raised if the <code>LSParser</code> doesn't
467
* support this method, or if the context node is of type
468
* <code>Document</code> and the DOM implementation doesn't support
469
* the replacement of the <code>DocumentType</code> child or
470
* <code>Element</code> child.
471
* <br> NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is a
472
* read only node and the content is being appended to its child list,
473
* or if the parent node of the context node is read only node and the
474
* content is being inserted in its child list.
475
* <br> INVALID_STATE_ERR: Raised if the <code>LSParser.busy</code>
476
* attribute is <code>true</code>.
477
* @exception LSException
478
* PARSE_ERR: Raised if the <code>LSParser</code> was unable to load
479
* the XML fragment. DOM applications should attach a
480
* <code>DOMErrorHandler</code> using the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
481
* error-handler</a>" if they wish to get details on the error.
482
*/
483
public Node parseWithContext(LSInput input,
484
Node contextArg,
485
short action)
486
throws DOMException, LSException;
487
488
/**
489
* Abort the loading of the document that is currently being loaded by
490
* the <code>LSParser</code>. If the <code>LSParser</code> is currently
491
* not busy, a call to this method does nothing.
492
*/
493
public void abort();
494
495
}
496
497