DOMImplementationLS
Stay organized with collections
Save and categorize content based on your preferences.
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.
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
|
|
Constants
public
static
final
short
MODE_ASYNCHRONOUS
Create an asynchronous LSParser
.
Constant Value:
2
public
static
final
short
MODE_SYNCHRONOUS
Create a synchronous LSParser
.
Constant Value:
1
Public Methods
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
"http://www.w3.org/2001/XMLSchema" . For XML DTD [XML 1.0],
applications must use the value
"http://www.w3.org/TR/REC-xml" . Other Schema languages
are outside the scope of the W3C and therefore should recommend an
absolute URI in order to use this method. |
Returns
- The newly created
LSParser
object. This
LSParser
is either synchronous or asynchronous
depending on the value of the mode
argument.
Note: By default, the newly created LSParser
does not contain a DOMErrorHandler
, i.e. the value of
the "
error-handler" configuration parameter is null
. 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 new LSParser
object 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
LSSerializer
object.
Note: By default, the newly created
LSSerializer
has no DOMErrorHandler
, i.e.
the value of the "error-handler"
configuration
parameter is null
. 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 new LSSerializer
object contains a
reference to the default error handler.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eDOMImplementationLS\u003c/code\u003e provides factory methods for creating Load and Save objects used for parsing and serializing XML documents.\u003c/p\u003e\n"],["\u003cp\u003eIt can be obtained by casting a \u003ccode\u003eDOMImplementation\u003c/code\u003e instance or using \u003ccode\u003eDOMImplementation.getFeature\u003c/code\u003e with specific parameters.\u003c/p\u003e\n"],["\u003cp\u003eOffers methods to create \u003ccode\u003eLSInput\u003c/code\u003e, \u003ccode\u003eLSOutput\u003c/code\u003e, \u003ccode\u003eLSParser\u003c/code\u003e (synchronous or asynchronous), and \u003ccode\u003eLSSerializer\u003c/code\u003e instances.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLSParser\u003c/code\u003e is used to parse XML documents according to a specified schema type, while \u003ccode\u003eLSSerializer\u003c/code\u003e is used to serialize DOM trees into XML.\u003c/p\u003e\n"],["\u003cp\u003eBoth \u003ccode\u003eLSParser\u003c/code\u003e and \u003ccode\u003eLSSerializer\u003c/code\u003e can be configured and may have a default error handler provided by the implementation.\u003c/p\u003e\n"]]],["`DOMImplementationLS` offers factory methods for creating Load and Save objects. It can be obtained via casting or `getFeature`. Key actions include: creating `LSInput` (empty input source), `LSOutput` (empty output destination), `LSParser` (synchronous or asynchronous, configurable with a schema type), and `LSSerializer` objects. `LSParser`'s mode is defined by `MODE_SYNCHRONOUS` or `MODE_ASYNCHRONOUS`. Newly created parser and serializer objects do not have an error handler by default.\n"],null,["public interface **DOMImplementationLS** \n`DOMImplementationLS` contains the factory methods for creating\nLoad and Save objects.\n\nThe expectation is that an instance of the\n`DOMImplementationLS` interface can be obtained by using\nbinding-specific casting methods on an instance of the\n`DOMImplementation` interface or, if the `Document`\nsupports the feature `\"Core\"` version `\"3.0\"`\ndefined in \\[[DOM Level 3 Core](http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407)\\]\n, by using the method `DOMImplementation.getFeature` with\nparameter values `\"LS\"` (or `\"LS-Async\"`) and\n`\"3.0\"` (respectively).\n\nSee also the [Document Object Model (DOM) Level 3 Load\nand Save Specification](http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407). \n\nConstant Summary\n\n|-------|---------------------------------------------------------------------------------------------------------|------------------------------------|\n| short | [MODE_ASYNCHRONOUS](../../../../../reference/org/w3c/dom/ls/DOMImplementationLS.html#MODE_ASYNCHRONOUS) | Create an asynchronous `LSParser`. |\n| short | [MODE_SYNCHRONOUS](../../../../../reference/org/w3c/dom/ls/DOMImplementationLS.html#MODE_SYNCHRONOUS) | Create a synchronous `LSParser`. |\n\nPublic Method Summary\n\n|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [LSInput](../../../../../reference/org/w3c/dom/ls/LSInput.html) | [createLSInput](../../../../../reference/org/w3c/dom/ls/DOMImplementationLS.html#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. |\n| abstract [LSOutput](../../../../../reference/org/w3c/dom/ls/LSOutput.html) | [createLSOutput](../../../../../reference/org/w3c/dom/ls/DOMImplementationLS.html#createLSOutput())() Create a new empty output destination object where `LSOutput.characterStream`, `LSOutput.byteStream`, `LSOutput.systemId`, `LSOutput.encoding` are null. |\n| abstract [LSParser](../../../../../reference/org/w3c/dom/ls/LSParser.html) | [createLSParser](../../../../../reference/org/w3c/dom/ls/DOMImplementationLS.html#createLSParser(short,%20java.lang.String))(short mode, [String](../../../../../reference/java/lang/String.html) schemaType) Create a new `LSParser`. |\n| abstract [LSSerializer](../../../../../reference/org/w3c/dom/ls/LSSerializer.html) | [createLSSerializer](../../../../../reference/org/w3c/dom/ls/DOMImplementationLS.html#createLSSerializer())() Create a new `LSSerializer` object. |\n\nConstants \n\npublic static final short\n**MODE_ASYNCHRONOUS** \nCreate an asynchronous `LSParser`. \nConstant Value: 2 \n\npublic static final short\n**MODE_SYNCHRONOUS** \nCreate a synchronous `LSParser`. \nConstant Value: 1\n\nPublic Methods \n\npublic abstract [LSInput](../../../../../reference/org/w3c/dom/ls/LSInput.html)\n**createLSInput**\n() \nCreate a new empty input source object where\n`LSInput.characterStream`, `LSInput.byteStream`\n, `LSInput.stringData` `LSInput.systemId`,\n`LSInput.publicId`, `LSInput.baseURI`, and\n`LSInput.encoding` are null, and\n`LSInput.certifiedText` is false. \n\nReturns\n\n- The newly created input object. \n\npublic abstract [LSOutput](../../../../../reference/org/w3c/dom/ls/LSOutput.html)\n**createLSOutput**\n() \nCreate a new empty output destination object where\n`LSOutput.characterStream`,\n`LSOutput.byteStream`, `LSOutput.systemId`,\n`LSOutput.encoding` are null. \n\nReturns\n\n- The newly created output object. \n\npublic abstract [LSParser](../../../../../reference/org/w3c/dom/ls/LSParser.html)\n**createLSParser**\n(short mode, [String](../../../../../reference/java/lang/String.html) schemaType) \nCreate a new `LSParser`. The newly constructed parser may\nthen be configured by means of its `DOMConfiguration`\nobject, and used to parse documents by means of its `parse`\nmethod. \n\nParameters\n\n| 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. |\n| 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](http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/)\\] , applications must use the value `\"http://www.w3.org/2001/XMLSchema\"`. For XML DTD \\[[XML 1.0](http://www.w3.org/TR/2004/REC-xml-20040204)\\], applications must use the value `\"http://www.w3.org/TR/REC-xml\"`. Other Schema languages are outside the scope of the W3C and therefore should recommend an absolute URI in order to use this method. |\n|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\nReturns\n\n- The newly created `LSParser` object. This `LSParser` is either synchronous or asynchronous depending on the value of the `mode` argument.\n\n **Note:** By default, the newly created `LSParser`\n does not contain a `DOMErrorHandler`, i.e. the value of\n the \"[error-handler](http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler)\" configuration parameter is `null`. However, implementations\n may provide a default error handler at creation time. In that case,\n the initial value of the `\"error-handler\"` configuration\n parameter on the new `LSParser` object contains a\nreference to the default error handler. \n\nThrows\n\n| [DOMException](../../../../../reference/org/w3c/dom/DOMException.html) | NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is not supported. |\n|------------------------------------------------------------------------|----------------------------------------------------------------------------------|\n\npublic abstract [LSSerializer](../../../../../reference/org/w3c/dom/ls/LSSerializer.html)\n**createLSSerializer**\n() \nCreate a new `LSSerializer` object. \n\nReturns\n\n- The newly created `LSSerializer` object.\n\n **Note:** By default, the newly created\n `LSSerializer` has no `DOMErrorHandler`, i.e.\n the value of the `\"error-handler\"` configuration\n parameter is `null`. However, implementations may\n provide a default error handler at creation time. In that case, the\n initial value of the `\"error-handler\"` configuration\n parameter on the new `LSSerializer` object contains a\n reference to the default error handler."]]