Method ResolveEntity
ResolveEntity(String, String, String, String)
Allows applications to map references to external entities into input sources, or tell the parser it should use conventional URI resolution. This method is only called for external entities which have been properly declared.
This method provides more flexibility than the IEntityResolver interface, supporting implementations of more complex catalogue schemes such as the one defined by theOASIS XML Catalogs specification.
Parsers configured to use this resolver method will call it to determine the input source to use for any external entity being included because of a reference in the XML text. That excludes the document entity, and any external entity returned by GetExternalSubset(String, String). When a(non - validating) processor is configured not to include a class of entities(parameter or general) through use of feature flags, this method is not invoked for such entities.
Note that the entity naming scheme used here is the same one used in the ILexicalHandler, or in the SkippedEntity(String) method.
Declaration
InputSource ResolveEntity(string name, string publicId, string baseURI, string systemId)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Identifies the external entity being resolved. Either "[dtd]" for the external subset, or a name starting with "%" to indicate a parameter entity, or else the name of a general entity. This is never null when invoked by a SAX2 |
System.String | publicId | The public identifier of the external entity being referenced (normalized as required by the XML specification), or null if none was supplied. |
System.String | baseURI | The URI with respect to which relative systemIDs are interpreted. This is always an absolute URI, unless it is null (likely because the IXMLReader was given an InputSource without one). This URI is defined by the XML specification to be the one associated with the "<" starting the relevant declaration. |
System.String | systemId | The system identifier of the external entity being referenced; either a relative or absolute URI. This is never null when invoked by a SAX2 parser; only declared entities, and any external subset, are resolved by such parsers. |
Returns
Type | Description |
---|---|
InputSource | An InputSource object describing the new input source to be used by the parser. Returning null directs the parser to resolve the system ID against the base URI and open a connection to resulting URI. |
Exceptions
Type | Condition |
---|---|
SAXException | Any SAX exception, possibly wrapping another exception. |