Udostępnij za pośrednictwem


IEntityResolver2.ResolveEntity(String, String, String, String) Method

Definition

Allows applications to map references to external entities into input sources, or tell the parser it should use conventional URI resolution.

[Android.Runtime.Register("resolveEntity", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/xml/sax/InputSource;", "GetResolveEntity_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Handler:Org.Xml.Sax.Ext.IEntityResolver2Invoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Org.Xml.Sax.InputSource? ResolveEntity (string? name, string? publicId, string? baseURI, string? systemId);
[<Android.Runtime.Register("resolveEntity", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/xml/sax/InputSource;", "GetResolveEntity_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Handler:Org.Xml.Sax.Ext.IEntityResolver2Invoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member ResolveEntity : string * string * string * string -> Org.Xml.Sax.InputSource

Parameters

name
String

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 parser.

publicId
String

The public identifier of the external entity being referenced (normalized as required by the XML specification), or null if none was supplied.

baseURI
String

The URI with respect to which relative systemIDs are interpreted. This is always an absolute URI, unless it is null (likely because the XMLReader was given an InputSource without one). This URI is defined by the XML specification to be the one associated with the "&lt;" starting the relevant declaration.

systemId
String

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

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.

Attributes

Exceptions

Any SAX exception, possibly wrapping another exception.

Probably indicating a failure to create a new InputStream or Reader, or an illegal URL.

Remarks

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 EntityResolver interface, supporting implementations of more complex catalogue schemes such as the one defined by the OASIS XML Catalogs specification.</p>

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 getExternalSubset(). 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 LexicalHandler, or in the org.xml.sax.ContentHandler#skippedEntity ContentHandler.skippedEntity() method.

Java documentation for org.xml.sax.ext.EntityResolver2.resolveEntity(java.lang.String, java.lang.String, java.lang.String, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to