Partager via


CreateXmlReader (Compact 7)

3/12/2014

This function creates a new IXmlReader.

Syntax

HRESULT CreateXmlReader (
    REFIID riid, 
    void** ppvObject, 
    IMalloc* pMalloc
);

Arguments

  • riid
    [in] The reference ID
  • ppvObject
    [out] An out argument that returns the reader
  • pMalloc
    [in] An IMalloc implementation specified by the user. This argument can be Null.

Return Value

This function returns S_OK if no error is generated.

Remarks

This constructor is used to create the reader. If no IMalloc is provided, the default implementation of IMalloc is used.

The following code creates a reader by using CreateXmlReader:

//Open read-only input stream
if (FAILED(hr = SHCreateStreamOnFile(argv[1], STGM_READ, &pFileStream)))
{
    wprintf(L"Error creating file reader, error is %08.8lx", hr);
    return -1;
}

if (FAILED(hr = CreateXmlReader(__uuidof(IXmlReader), (void**) &pReader, NULL)))
{
    wprintf(L"Error creating xml reader, error is %08.8lx", hr);
    return -1;
}

See Also

Reference

Functions
IXmlReader
IMalloc
Error Codes