共用方式為


CreateXmlReader

 

Creates a new IXmlReader.

Syntax

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

Arguments

riid
The reference ID.

ppvObject
An out argument that returns the reader.

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

Return Value

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;  
}  

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlReader Functions
IXmlReader Methods