SetInput
Sets the input source of the XML document to be parsed.
HRESULT SetInput ([in] IUnknown * pInput);
pInput
The input stream to be parsed.
Returns S_OK if no error is generated.
The input source can be one of the following types:
A class derived from
IStreamorISequentialStream. The reader will use defaults for all the additional properties of the input.IMallocand base URI will be empty. There will be no use of alternative character set encoding.IXmlReaderInput. The input is described by an instance of the
IXmlReaderInputclass. Using an instance of this class, the user can specify additional properties of the input (like alternative character set encoding and base URI). Use CreateXmlReaderInputWithEncodingCodePage or CreateXmlReaderInputWithEncodingName to get an instance ofIXmlReaderInput.NULL. This resets the input, releasing the previously set input object.
The following code sets the input source for a reader:
//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; } if (FAILED(hr = pReader->SetProperty(XmlReaderProperty_DtdProcessing, DtdProcessing_Prohibit))) { wprintf(L"Error setting XmlReaderProperty_DtdProcessing, error is %08.8lx", hr); return -1; } if (FAILED(hr = pReader->SetInput(pFileStream))) { wprintf(L"Error setting input for reader, error is %08.8lx", hr); return -1; }
Header: XmlLite.h
Library: XmlLite.lib
CreateXmlReaderInputWithEncodingCodePage
CreateXmlReaderInputWithEncodingName
IXmlReader Methods