public class LocatorImpl
extends Object implements Locator
| java.lang.Object | |
| org.xml.sax.helpers.LocatorImpl | |
| |
提供Locator的可选便利实现。
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.
这个类主要用于应用程序编写者,他们可以使用它在文档分析过程中的任何时刻创建一个定位器的持久快照:
Locator locator;
Locator startloc;
public void setLocator (Locator locator)
{
// note the locator
this.locator = locator;
}
public void startDocument ()
{
// save the location of the start of the document
// for future use.
Locator startloc = new LocatorImpl(locator);
}
通常,解析器编写者不会使用这个类,因为只有在请求时才提供位置信息更有效,而不是不断更新定位器对象。
也可以看看:
Public constructors |
|
|---|---|
LocatorImpl() 零参数构造函数。 |
|
LocatorImpl(Locator locator) 复制构造函数。 |
|
公共方法(Public methods) |
|
|---|---|
int |
getColumnNumber() 返回保存的列号(从1开始)。 |
int |
getLineNumber() 返回保存的行号(从1开始)。 |
String |
getPublicId() 返回保存的公共标识符。 |
String |
getSystemId() 返回保存的系统标识符。 |
void |
setColumnNumber(int columnNumber) 设置此定位器的列号(从1开始)。 |
void |
setLineNumber(int lineNumber) 设置此定位器的行号(从1开始)。 |
void |
setPublicId(String publicId) 为此定位器设置公共标识符。 |
void |
setSystemId(String systemId) 设置此定位器的系统标识符。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
org.xml.sax.Locator
|
|
LocatorImpl (Locator locator)
复制构造函数。
创建定位器当前状态的持久副本。 原始定位器更改时,此副本仍将保留原始值(并且可以在DocumentHandler方法的范围外使用)。
| 参数(Parameters) | |
|---|---|
locator |
Locator: The locator to copy. |
int getColumnNumber ()
返回保存的列号(从1开始)。
| 返回(Returns) | |
|---|---|
int |
The column number as an integer, or -1 if none is available. |
int getLineNumber ()
返回保存的行号(从1开始)。
| 返回(Returns) | |
|---|---|
int |
The line number as an integer, or -1 if none is available. |
String getPublicId ()
返回保存的公共标识符。
| 返回(Returns) | |
|---|---|
String |
The public identifier as a string, or null if none is available. |
也可以看看:
String getSystemId ()
返回保存的系统标识符。
| 返回(Returns) | |
|---|---|
String |
The system identifier as a string, or null if none is available. |
也可以看看:
void setColumnNumber (int columnNumber)
设置此定位器的列号(从1开始)。
| 参数(Parameters) | |
|---|---|
columnNumber |
int: The column number, or -1 if none is available. |
也可以看看:
void setLineNumber (int lineNumber)
设置此定位器的行号(从1开始)。
| 参数(Parameters) | |
|---|---|
lineNumber |
int: The line number, or -1 if none is available. |
也可以看看:
void setPublicId (String publicId)
为此定位器设置公共标识符。
| 参数(Parameters) | |
|---|---|
publicId |
String: The new public identifier, or null if none is available. |
也可以看看:
void setSystemId (String systemId)
设置此定位器的系统标识符。
| 参数(Parameters) | |
|---|---|
systemId |
String: The new system identifier, or null if none is available. |
也可以看看: