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. When parsing the input stream, the context node (or its parent, depending on where the result will be inserted) is used for resolving unbound namespace prefixes. The context node's
ownerDocument
node (or the node itself if the node of type
DOCUMENT_NODE
) is used to resolve default attributes and entity references.
As the new data is inserted into the document, at least one mutation event is fired per new immediate child or sibling of the context node.
If the context node is a
Document
node and the action is
ACTION_REPLACE_CHILDREN
, then the document that is passed as the context node will be changed such that its
xmlEncoding
,
documentURI
,
xmlVersion
,
inputEncoding
,
xmlStandalone
, and all other such attributes are set to what they would be set to if the input source was parsed using
LSParser.parse()
.
This method is always synchronous, even if the
LSParser
is asynchronous (
LSParser.async
is
true
).
If an error occurs while parsing, the caller is notified through the
ErrorHandler
instance associated with the "
error-handler" parameter of the
DOMConfiguration
.
When calling
parseWithContext
, the values of the following configuration parameters will be ignored and their default values will always be used instead: "
validate", "
validate-if-schema", and "
element-content-whitespace". Other parameters will be treated normally, and the parser is expected to call the
LSParserFilter
just as if a whole document was parsed.