Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
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 varInputis 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.

Copy Code
   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 ISAXErrorHandlerinterface. If the error handler returns anything but S_OK, parsing is aborted and the parsemethod 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 parsemethod. 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