Share via


ILSParser Interface

Definition

An interface to an object that is able to build, or augment, a DOM tree from various input sources.

[Android.Runtime.Register("org/w3c/dom/ls/LSParser", "", "Org.W3c.Dom.LS.ILSParserInvoker")]
public interface ILSParser : Android.Runtime.IJavaObject, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("org/w3c/dom/ls/LSParser", "", "Org.W3c.Dom.LS.ILSParserInvoker")>]
type ILSParser = interface
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Attributes
Implements

Remarks

An interface to an object that is able to build, or augment, a DOM tree from various input sources.

LSParser provides an API for parsing XML and building the corresponding DOM document structure. A LSParser instance can be obtained by invoking the DOMImplementationLS.createLSParser() method.

As specified in [DOM Level 3 Core] , when a document is first made available via the LSParser: <ul> <li> there will never be two adjacent nodes of type NODE_TEXT, and there will never be empty text nodes. </li> <li> it is expected that the value and nodeValue attributes of an Attr node initially return the XML 1.0 normalized value. However, if the parameters " validate-if-schema" and " datatype-normalization" are set to true, depending on the attribute normalization used, the attribute values may differ from the ones obtained by the XML 1.0 attribute normalization. If the parameters " datatype-normalization" is set to false, the XML 1.0 attribute normalization is guaranteed to occur, and if the attributes list does not contain namespace declarations, the attributes attribute on Element node represents the property <b>[attributes]</b> defined in [XML Information Set] . </li> </ul>

Asynchronous LSParser objects are expected to also implement the events::EventTarget interface so that event listeners can be registered on asynchronous LSParser objects.

Events supported by asynchronous LSParser objects are: <dl> <dt>load</dt> <dd> The LSParser finishes to load the document. See also the definition of the LSLoadEvent interface. </dd> <dt>progress</dt> <dd> The LSParser signals progress as data is parsed. This specification does not attempt to define exactly when progress events should be dispatched. That is intentionally left as implementation-dependent. Here is one example of how an application might dispatch progress events: Once the parser starts receiving data, a progress event is dispatched to indicate that the parsing starts. From there on, a progress event is dispatched for every 4096 bytes of data that is received and processed. This is only one example, though, and implementations can choose to dispatch progress events at any time while parsing, or not dispatch them at all. See also the definition of the LSProgressEvent interface. </dd> </dl> <p ><b>Note:</b> All events defined in this specification use the namespace URI "http://www.w3.org/2002/DOMLS".

While parsing an input source, errors are reported to the application through the error handler (LSParser.domConfig's " error-handler" parameter). This specification does in no way try to define all possible errors that can occur while parsing XML, or any other markup, but some common error cases are defined. The types (DOMError.type) of errors and warnings defined by this specification are: <dl> <dt> "check-character-normalization-failure" [error]</dt> <dd> Raised if the parameter " check-character-normalization" is set to true and a string is encountered that fails normalization checking. </dd> <dt>"doctype-not-allowed" [fatal]</dt> <dd> Raised if the configuration parameter "disallow-doctype" is set to true and a doctype is encountered. </dd> <dt>"no-input-specified" [fatal]</dt> <dd> Raised when loading a document and no input is specified in the LSInput object. </dd> <dt> "pi-base-uri-not-preserved" [warning]</dt> <dd> Raised if a processing instruction is encountered in a location where the base URI of the processing instruction can not be preserved. One example of a case where this warning will be raised is if the configuration parameter " entities" is set to false and the following XML file is parsed:

&lt;!DOCTYPE root [ &lt;!ENTITY e SYSTEM 'subdir/myentity.ent' ]&gt;
            &lt;root&gt; &amp;e; &lt;/root&gt;

And subdir/myentity.ent contains:

&lt;one&gt; &lt;two/&gt; &lt;/one&gt; &lt;?pi 3.14159?&gt;
            &lt;more/&gt;

</dd> <dt>"unbound-prefix-in-entity" [warning]</dt> <dd> An implementation dependent warning that may be raised if the configuration parameter " namespaces" is set to true and an unbound namespace prefix is encountered in an entity's replacement text. Raising this warning is not enforced since some existing parsers may not recognize unbound namespace prefixes in the replacement text of entities. </dd> <dt> "unknown-character-denormalization" [fatal]</dt> <dd> Raised if the configuration parameter "ignore-unknown-character-denormalizations" is set to false and a character is encountered for which the processor cannot determine the normalization properties. </dd> <dt> "unsupported-encoding" [fatal]</dt> <dd> Raised if an unsupported encoding is encountered. </dd> <dt>"unsupported-media-type" [fatal]</dt> <dd> Raised if the configuration parameter "supported-media-types-only" is set to true and an unsupported media type is encountered. </dd> </dl>

In addition to raising the defined errors and warnings, implementations are expected to raise implementation specific errors and warnings for any other error and warning cases such as IO errors (file not found, permission denied,...), XML well-formedness errors, and so on.

See also the Document Object Model (DOM) Level 3 Load and Save Specification.

Java documentation for org.w3c.dom.ls.LSParser.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

ActionAppendAsChildren

Append the result of the parse operation as children of the context node.

ActionInsertAfter

Insert the result of the parse operation as the immediately following sibling of the context node.

ActionInsertBefore

Insert the result of the parse operation as the immediately preceding sibling of the context node.

ActionReplace

Replace the context node with the result of the parse operation.

ActionReplaceChildren

Replace all the children of the context node with the result of the parse operation.

Properties

Async

true if the LSParser is asynchronous, false if it is synchronous.

Busy

true if the LSParser is currently busy loading a document, otherwise false.

DomConfig

The DOMConfiguration object used when parsing an input source.

Filter

When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure.

Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)

Methods

Abort()

Abort the loading of the document that is currently being loaded by the LSParser.

Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
Parse(ILSInput)

Parse an XML document from a resource identified by a LSInput.

ParseURI(String)

Parse an XML document from a location identified by a URI reference [IETF RFC 2396].

ParseWithContext(ILSInput, INode, Int16)

Parse an XML fragment from a resource identified by a LSInput and insert the content into an existing document at the position specified with the context and action arguments.

SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)
ParseAsync(ILSParser, ILSInput)
ParseURIAsync(ILSParser, String)
ParseWithContextAsync(ILSParser, ILSInput, INode, Int16)

Applies to