共用方式為


CreateXmlReaderInputWithEncodingName

 

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

Syntax

  
HRESULT CreateXmlReaderInputWithEncodingName (  
    [in] IUnknown * pInputStream ,   
    [in] IMalloc * pMalloc,  
    [in] const WCHAR * pwszEncodingName ,  
    [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.

pwszEncodingName
Specifies the encoding of the input. The user can specify the encoding as a name of the encoding. The actual behavior of the reader depends on the fEncodingHint flag.

fEncodingHint
The value of this parameter is only considered if no BOM is available in the stream. If TRUE, the parser will attempt to use the encoding specified in pwszEncodingName. If the encoding of the file is different than that specified in pwszEncodingName, the parser will attempt to determine the encoding. If FALSE, the parser must use the encoding specified in pwszEncodingName. 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.

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlReader Functions
IXmlReaderInput