Share via


ISAXLocator Interface

 

The ISAXLocator/IVBSAXLocator interface associates a SAX2 event with a document location.

The SAX2 reader provides location information by implementing this interface and passing an instance to the application, using the documentLocator property of the IVBSAXContentHandler interface. The application can use the Locator object to get the property values defined for this interface. These values describe location information associated with the current event, such as system ID, public ID, line number, and column number of any ContentHandler event in the XML source document.

Properties

columnNumber Returns the column number where the current document event ends.
lineNumber Returns the line number where the current document event ends.
publicId Returns the public identifier for the current document event.
systemId Returns the system identifier for the current document event.

The SAX2 reader provides location information by implementing this interface and passing an instance to the application using the putDocumentLocator method of the ISAXContentHandler interface. The application can use the Locator object to obtain the location of any other document handler event in the XML source document.

The Locator object has a one-to-one relationship with the reader. As a result, each new event updates the information inside the Locator object. For example, an application saves a reference to the Locator object for handler call A. After that, the application tries to access the Locator object in handler call B. The information provided by the Locator object is now specific to handler call B because the object updates with each event. Correct usage for the Locator object is to save a reference to it within the ContentHandler and access it from there. For ErrorHandler methods, the Locator object is passed as a parameter.

Methods

getColumnNumber Returns the column number where the current document event ends.
getLineNumber Returns the line number where the current document event ends.
getPublicId Returns the public identifier for the current document event.
getSystemId Returns the system identifier for the current document event.

Requirements

Implementation:

msxml3.dll (MSXML 3.0)

msxml6.dll (MSXML 6.0)

Header and LIB files: msxml2.h, msxml2.lib

Remarks

Results returned by the object are valid only during the scope of each document handler method. The application receives unpredictable results if it attempts to use the locator at any other time. If the reader supplies a locator, it must do so before reporting any other document events. If no locator is set by the time the application receives the startDocument method event, the application should assume that a locator is not available.

Versioning

Implemented in: MSXML 3.0 and later

See Also

documentLocator Property (Visual Basic)
putDocumentLocator Method (C-C++)
ISAXContentHandler Interface
startDocument Method