AI-generated Key Takeaways
-
DOMImplementationLSprovides factory methods for creating Load and Save objects used for parsing and serializing XML documents. -
It can be obtained by casting a
DOMImplementationinstance or usingDOMImplementation.getFeaturewith specific parameters. -
Offers methods to create
LSInput,LSOutput,LSParser(synchronous or asynchronous), andLSSerializerinstances. -
LSParseris used to parse XML documents according to a specified schema type, whileLSSerializeris used to serialize DOM trees into XML. -
Both
LSParserandLSSerializercan be configured and may have a default error handler provided by the implementation.
DOMImplementationLS contains the factory methods for creating
Load and Save objects.
The expectation is that an instance of the
DOMImplementationLS interface can be obtained by using
binding-specific casting methods on an instance of the
DOMImplementation interface or, if the Document
supports the feature "Core" version "3.0"
defined in [DOM Level 3 Core]
, by using the method DOMImplementation.getFeature with
parameter values "LS" (or "LS-Async") and
"3.0" (respectively).
See also the Document Object Model (DOM) Level 3 Load and Save Specification.
Constant Summary
| short | MODE_ASYNCHRONOUS | Create an asynchronous LSParser. |
| short | MODE_SYNCHRONOUS | Create a synchronous LSParser. |
Public Method Summary
| abstract LSInput |
createLSInput()
Create a new empty input source object where
LSInput.characterStream, LSInput.byteStream
, LSInput.stringData LSInput.systemId,
LSInput.publicId, LSInput.baseURI, and
LSInput.encoding are null, and
LSInput.certifiedText is false. |
| abstract LSOutput |
createLSOutput()
Create a new empty output destination object where
LSOutput.characterStream,
LSOutput.byteStream, LSOutput.systemId,
LSOutput.encoding are null. |
| abstract LSParser | |
| abstract LSSerializer |
createLSSerializer()
Create a new
LSSerializer object. |
Constants
public static final short MODE_ASYNCHRONOUS
Create an asynchronous LSParser.
public static final short MODE_SYNCHRONOUS
Create a synchronous LSParser.
Public Methods
public abstract LSInput createLSInput ()
Create a new empty input source object where
LSInput.characterStream, LSInput.byteStream
, LSInput.stringData LSInput.systemId,
LSInput.publicId, LSInput.baseURI, and
LSInput.encoding are null, and
LSInput.certifiedText is false.
Returns
- The newly created input object.
public abstract LSOutput createLSOutput ()
Create a new empty output destination object where
LSOutput.characterStream,
LSOutput.byteStream, LSOutput.systemId,
LSOutput.encoding are null.
Returns
- The newly created output object.
public abstract LSParser createLSParser (short mode, String schemaType)
Create a new LSParser. The newly constructed parser may
then be configured by means of its DOMConfiguration
object, and used to parse documents by means of its parse
method.
Parameters
| mode | The mode argument is either
MODE_SYNCHRONOUS or MODE_ASYNCHRONOUS, if
mode is MODE_SYNCHRONOUS then the
LSParser that is created will operate in synchronous
mode, if it's MODE_ASYNCHRONOUS then the
LSParser that is created will operate in asynchronous
mode. |
|---|---|
| schemaType | An absolute URI representing the type of the schema
language used during the load of a Document using the
newly created LSParser. Note that no lexical checking
is done on the absolute URI. In order to create a
LSParser for any kind of schema types (i.e. the
LSParser will be free to use any schema found), use the value
null.
Note: For W3C XML Schema [XML Schema Part 1]
, applications must use the value
|
Returns
- The newly created
LSParserobject. ThisLSParseris either synchronous or asynchronous depending on the value of themodeargument.Note: By default, the newly created
LSParserdoes not contain aDOMErrorHandler, i.e. the value of the " error-handler" configuration parameter isnull. However, implementations may provide a default error handler at creation time. In that case, the initial value of the"error-handler"configuration parameter on the newLSParserobject contains a reference to the default error handler.
Throws
| DOMException | NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is not supported. |
|---|
public abstract LSSerializer createLSSerializer ()
Create a new LSSerializer object.
Returns
- The newly created
LSSerializerobject.Note: By default, the newly created
LSSerializerhas noDOMErrorHandler, i.e. the value of the"error-handler"configuration parameter isnull. However, implementations may provide a default error handler at creation time. In that case, the initial value of the"error-handler"configuration parameter on the newLSSerializerobject contains a reference to the default error handler.