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.
The base URI for the external entity.
The public ID.
The system ID.
The resolved input returned by the method.
Returns S_OK if no error is generated.
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
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.