Condividi tramite


IContentHandler.SetDocumentLocator(ILocator) Method

Definition

Receive an object for locating the origin of SAX document events.

[Android.Runtime.Register("setDocumentLocator", "(Lorg/xml/sax/Locator;)V", "GetSetDocumentLocator_Lorg_xml_sax_Locator_Handler:Org.Xml.Sax.IContentHandlerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void SetDocumentLocator (Org.Xml.Sax.ILocator? locator);
[<Android.Runtime.Register("setDocumentLocator", "(Lorg/xml/sax/Locator;)V", "GetSetDocumentLocator_Lorg_xml_sax_Locator_Handler:Org.Xml.Sax.IContentHandlerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetDocumentLocator : Org.Xml.Sax.ILocator -> unit

Parameters

locator
ILocator

an object that can return the location of any SAX document event

Attributes

Remarks

Receive an object for locating the origin of SAX document events.

SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the ContentHandler interface.

The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.

Note that the locator will return correct information only during the invocation SAX event callbacks after #startDocument startDocument returns and before #endDocument endDocument is called. The application should not attempt to use it at any other time.

Java documentation for org.xml.sax.ContentHandler.setDocumentLocator(org.xml.sax.Locator).

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

See also