Freigeben über


ResolveUri

 

This method is called by an IXmlReader when the reader has to resolve external entities. An application can provide an implementation of this interface to enable external entity resolution.

Syntax

  
HRESULT ResolveUri (  
    [in] const WCHAR * pwszBaseUri,  
    [in] const WCHAR * pwszPublicIdentifier,  
    [in] const WCHAR *  pwszSystemIdentifier,  
    [out] IUnknown ** ppResolvedInput);  

Arguments

pwszBaseUri
The base URI for the external entity.

pwszPublicIdentifier
The public ID.

pwszSystemIdentifier
The system ID.

ppResolvedInput
The resolved input 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 an external entity is encountered.

By default, an IXmlReader has a resolver set to NULL. In this case, external entities are ignored—the reader simply 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

  1. The reader will propagate the error value returned and parsing will fail.

Note that the reader only accepts the success code S_OK. If the reader receives any other success code, the reader fails with E_FAIL.

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

XmlReaderProperty_XmlResolver