Expand Minimize


Creates a new IXmlReader.

HRESULT CreateXmlReader ([in] REFIID riid, [out] void ** ppvObject, [in] IMalloc * pMalloc);


The reference ID.


An out argument that returns the reader.


An IMalloc implementation specified by the user. This argument can be Null.

Returns S_OK if no error is generated.

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;

Header: XmlLite.h

Library: XmlLite.lib

© 2014 Microsoft