Class Locator
Provide an optional convenience implementation of ILocator.
Inheritance
Assembly: Lucene.Net.Benchmark.dll
Syntax
public class Locator : object, ILocator
Remarks
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. Seehttp://www.saxproject.org for further information.
This class is available mainly for application writers, who can use it to make a persistent snapshot of a locator at any point during a document parse:
ILocator locator;
ILocator startloc;
public void SetLocator(ILocator locator)
{
// note the locator
this.locator = locator;
}
public void StartDocument()
{
// save the location of the start of the document
// for future use.
ILocator startloc = new Locator(locator);
}
Normally, parser writers will not use this class, since it is more efficient to provide location information only when requested, rather than constantly updating a ILocator object.
Constructors
Name | Description |
---|---|
Locator() | Zero-argument constructor. This will not normally be useful, since the main purpose of this class is to make a snapshot of an existing ILocator. |
Locator(ILocator) | Copy constructor. Create a persistent copy of the current state of a locator. When the original locator changes, this copy will still keep the original values (and it can be used outside the scope of DocumentHandler methods). |
Properties
Name | Description |
---|---|
ColumnNumber | Gets the saved column number (1-based). Returns the column number as an integer, or -1 if none is available. |
LineNumber | Gets the saved line number (1-based). Returns the line number as an integer, or -1 if none is available. |
PublicId | Gets the public identifier as a string, or null if none is available. |
SystemId | Gets the system identifier as a string, or null if none is available. |