CreateXmlReaderInputWithEncodingCodePage

 

Creates an instance of IXmlReaderInput with the provided parameters. This is normally used when the input stream does not have a BOM.

Syntax

  
HRESULT CreateXmlReaderInputWithEncodingCodePage (  
    [in] IUnknown * pInputStream ,  
    [in] IMalloc * pMalloc,  
    [in] UINT nEncodingCodePage,  
    [in] BOOL fEncodingHint,  
    [in] const WCHAR * pwszBaseUri ,  
    [out] IXmlReaderInput ** ppInput);  

Arguments

pInputStream
A pointer to the input stream for the reader to read the data from. This can be either an ISequentialStream or an IStream interface. It is recommended that the IStream interface be implemented for the stream even if some of its methods would return E_NOTIMPL. It is also recommended that the stat method be implemented so the size of the stream can be queried, because this can result in better performance.

This parameter cannot be NULL.

pMalloc
A pointer to a user-provided implementation of the IMalloc interface. The reader will use this for all memory allocation. If this parameter is NULL, the reader will use its own implementation.

nEncodingCodePage
Specifies the encoding of the input. The user can specify the encoding as a codepage number. The actual behavior of the reader depends on the fEncodingHint flag. A value of zero indicates an unknown code page.

fEncodingHint
The value of this parameter is only considered if no BOM is available in the stream. If TRUE, the parser attempts to use the encoding specified in pwszEncodingCodePage. If the encoding of the file is different than that specified in pwszEncodingCodePage, the parser will attempt to determine the encoding. If FALSE, the parser must use the encoding specified in pwszEncodingCodePage. Any other encoding results in an error.

pwszBaseUri
The base URI for this input stream. This value is passed to ResolveUri when XmlLite is resolving external entities.

ppInput
The new IXmlReaderInput. This parameter cannot be NULL.

Return Value

Returns S_OK if no error is generated.

Remarks

To set the base URI for the input stream when the encoding (input) code page is not known, set the nEncodingCodePage parameter to zero.

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlReader Functions
IXmlReaderInput