ResolveUri (Compact 7)
3/12/2014
This method is called by an IXmlReader when the reader must resolve external entities. An application can provide an implementation of this interface to enable external entity resolution.
Syntax
HRESULT ResolveUri (
const WCHAR* pwszBaseUri,
const WCHAR* pwszPublicIdentifier,
const WCHAR* pwszSystemIdentifier,
IUnknown** ppResolvedInput
);
Arguments
- pwszBaseUri
[in] The base URI for the external entity
- pwszPublicIdentifier
[in] The public ID
- pwszSystemIdentifier
[in] The system ID
- ppResolvedInput
[out] The resolved input that is returned by the method
Return Value
Returns S_OK if no error is generated.
Remarks
To return a resolved entity, the implementation can return ISequentialStream, IStream, or IXmlReaderInput through the pResolvedInput parameter. To create an instance of the IXmlReaderInput, you can use either CreateXmlReaderInputWithEncodingCodePage or CreateXmlReaderInputWithEncodingName.
This method is called every time that an external entity is encountered.
By default, an IXmlReader has a resolver set to NULL. In this case, external entities are ignored: the reader merely replaces external entities with an empty string. However, if a resolver is set for a reader, the reader calls the ResolveUri method of that resolver for each external entity in the input.
The ResolveUri method can return one of the following combinations of results:
- S_OK and a ppResolvedInput value that is not NULL. In this case, the reader will replace the entity reference with the input from the ppResolvedInput.
- S_OK and NULL (ppResolvedInput points to NULL). In this case, the reader will replace the entity reference with empty input.
- Any return value other than S_OK. The reader will propagate the error value returned and parsing will fail.
The reader accepts the success code S_OK only. If the reader receives any other success code, the reader fails with E_FAIL.
See Also
Reference
IXmlResolver Methods
ISequentialStream
IStream
IXmlReaderInput
IXmlReaderInput
CreateXmlReaderInputWithEncodingCodePage
CreateXmlReaderInputWithEncodingName
ResolveUri
XmlReaderProperty_XmlResolver