Method Parse
Parse(InputSource)
Parse an XML document.
Declaration
void Parse(InputSource input)
Parameters
Type | Name | Description |
---|---|---|
InputSource | input | The input source for the top-level of the XML document. |
Remarks
The application can use this method to instruct the XML reader to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).
Applications may not invoke this method while a parse is in progress (they should create a new XMLReader instead for each nested XML document). Once a parse is complete, an application may reuse the same XMLReader object, possibly with a different input source. Configuration of the IXMLReader object (such as handler bindings and values established for feature flags and properties) is unchanged by completion of a parse, unless the definition of that aspect of the configuration explicitly specifies other behavior. (For example, feature flags or properties exposing characteristics of the document being parsed.)
During the parse, the XMLReader will provide information about the XML document through the registered event handlers.
This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception.
Exceptions
Type | Condition |
---|---|
SAXException | Any SAX exception, possibly wrapping another exception. |
See Also
Parse(String)
Parse an XML document from a system identifier (URI).
Declaration
void Parse(string systemId)
Parameters
Type | Name | Description |
---|---|---|
System.String | systemId | The system identifier (URI). |
Remarks
This method is a shortcut for the common case of reading a document from a system identifier. It is the exact equivalent of the following:
Parse(new InputSource(systemId));
If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser.
Exceptions
Type | Condition |
---|---|
SAXException | Any SAX exception, possibly wrapping another exception. |