Sdílet prostřednictvím


ILSParser.ParseWithContext(ILSInput, INode, Int16) Method

Definition

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.

[Android.Runtime.Register("parseWithContext", "(Lorg/w3c/dom/ls/LSInput;Lorg/w3c/dom/Node;S)Lorg/w3c/dom/Node;", "GetParseWithContext_Lorg_w3c_dom_ls_LSInput_Lorg_w3c_dom_Node_SHandler:Org.W3c.Dom.LS.ILSParserInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Org.W3c.Dom.INode? ParseWithContext (Org.W3c.Dom.LS.ILSInput? input, Org.W3c.Dom.INode? contextArg, short action);
[<Android.Runtime.Register("parseWithContext", "(Lorg/w3c/dom/ls/LSInput;Lorg/w3c/dom/Node;S)Lorg/w3c/dom/Node;", "GetParseWithContext_Lorg_w3c_dom_ls_LSInput_Lorg_w3c_dom_Node_SHandler:Org.W3c.Dom.LS.ILSParserInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member ParseWithContext : Org.W3c.Dom.LS.ILSInput * Org.W3c.Dom.INode * int16 -> Org.W3c.Dom.INode

Parameters

input
ILSInput

The LSInput from which the source document is to be read. The source document must be an XML fragment, i.e. anything except a complete XML document (except in the case where the context node of type DOCUMENT_NODE, and the action is ACTION_REPLACE_CHILDREN), a DOCTYPE (internal subset), entity declaration(s), notation declaration(s), or XML or text declaration(s).

contextArg
INode

The node that is used as the context for the data that is being parsed. This node must be a Document node, a DocumentFragment node, or a node of a type that is allowed as a child of an Element node, e.g. it cannot be an Attribute node.

action
Int16

This parameter describes which action should be taken between the new set of nodes being inserted and the existing children of the context node. The set of possible actions is defined in ACTION_TYPES above.

Returns

Return the node that is the result of the parse operation. If the result is more than one top-level node, the first one is returned.

Attributes

Exceptions

HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be inserted before, after, or as a child of the context node (see also Node.insertBefore or Node.replaceChild in [] ).
NOT_SUPPORTED_ERR: Raised if the LSParser doesn't support this method, or if the context node is of type Document and the DOM implementation doesn't support the replacement of the DocumentType child or Element child.
NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is a read only node and the content is being appended to its child list, or if the parent node of the context node is read only node and the content is being inserted in its child list.
INVALID_STATE_ERR: Raised if the LSParser.busy attribute is true.

PARSE_ERR: Raised if the LSParser was unable to load the XML fragment. DOM applications should attach a DOMErrorHandler using the parameter "" if they wish to get details on the error.

Remarks

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. <br> 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. <br> 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(). <br> This method is always synchronous, even if the LSParser is asynchronous (LSParser.async is true). <br> If an error occurs while parsing, the caller is notified through the ErrorHandler instance associated with the " error-handler" parameter of the DOMConfiguration. <br> 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.

Java documentation for org.w3c.dom.ls.LSParser.parseWithContext(org.w3c.dom.ls.LSInput, org.w3c.dom.Node, short).

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.

Applies to