Compartilhar via


ISAXXMLReader::parse Method

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This method parses an XML document.

Syntax

HRESULT parse(
  VARIANT varInput
);

Parameters

  • varInput
    [in] Variant containing the input source to parse from. See Remarks for supported VARIANT types.

Return Value

  • S_OK
    Returned if parsing is successful.
  • E_INVALIDARG
    Returned if varInput is not a recognized input source.
  • Other
    Parser error code or the code returned by the custom error handler.

Remarks

The application can use this method to instruct the reader to begin parsing a document from a variety of sources. Supported VARIANT types are VT_BSTR, SafeArray of bytes (VT_ARRAYVT_UI1), VT_UNK(IStream), and VT_UNK(ISequentialStream). One-level referencing is also permitted.

   VT_BYREF | VT_VARIANT d
   VT_BYREF | VT_VARIANT -> VT_BSTR
   VT_BYREF | VT_VARIANT -> IStream
   VT_BYREF | VT_VARIANT -> VT_ARRAY|VT_UI1

An application cannot invoke this method while parsing is in progress. Instead, it should create a new instance of the reader for each nested XML document. After parsing is complete, an application can reuse the same reader object, possibly with a different input source.

While parsing, the reader provides information about the XML document through the registered event handlers. If an error occurs during parsing, the reader calls the appropriate method of the ISAXErrorHandler interface. If the error handler returns anything but S_OK, parsing is aborted and the parse method returns the internal error that stopped the parser. Note that the error handler always returns the internal error code, even if the error handler returns a user-defined HRESULT to the parse method. The reader can return a number of return codes, including, but not limited to E_ACCESSDENIED, INET_E_OBJECT_NOT_FOUND, INET_E_DOWNLOAD_FAILURE, MSG_E_BADSTARTNAMECHAR, or MSG_E_MISSINGSEMICOLON.

Requirements

Header msxml2.h, msxml2.idl
Library uuid.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

ISAXXMLReader::putEntityResolver Method
ISAXXMLReader::putDTDHandler Method
ISAXXMLReader::putContentHandler Method
ISAXXMLReader::putErrorHandler Method
ISAXXMLReader