下面列出了org.xml.sax.Locator#getColumnNumber ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
// Mutation event fired by the adding of element end,
// and so lastAddedElement will be set.
super.endElement(uri, localName, qName);
if (locatorStack.size() > 0) {
Locator startLocator = locatorStack.pop();
XmlLocationData location = new XmlLocationData(
startLocator.getSystemId(),
startLocator.getLineNumber(),
startLocator.getColumnNumber(),
locator.getLineNumber(),
locator.getColumnNumber());
Element lastAddedElement = elementStack.pop();
lastAddedElement.setUserData(
XmlLocationData.LOCATION_DATA_KEY, location,
dataHandler);
}
}
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
// Mutation event fired by the adding of element end,
// and so lastAddedElement will be set.
super.endElement(uri, localName, qName);
if (locatorStack.size() > 0) {
Locator startLocator = locatorStack.pop();
XmlLocationData location = new XmlLocationData(
startLocator.getSystemId(),
startLocator.getLineNumber(),
startLocator.getColumnNumber(),
locator.getLineNumber(),
locator.getColumnNumber());
Element lastAddedElement = elementStack.pop();
lastAddedElement.setUserData(
XmlLocationData.LOCATION_DATA_KEY, location,
dataHandler);
}
}
/**
* Compares if two {@link Locator}s point to the exact same position.
*/
public static boolean equals(Locator lhs, Locator rhs) {
return lhs.getLineNumber()==rhs.getLineNumber()
&& lhs.getColumnNumber()==rhs.getColumnNumber()
&& equals(lhs.getSystemId(),rhs.getSystemId())
&& equals(lhs.getPublicId(),rhs.getPublicId());
}
private SAXLocation(Locator locator) {
lineNumber = locator.getLineNumber();
columnNumber = locator.getColumnNumber();
publicId = locator.getPublicId();
systemId = locator.getSystemId();
}
private SAXLocation(Locator locator) {
lineNumber = locator.getLineNumber();
columnNumber = locator.getColumnNumber();
publicId = locator.getPublicId();
systemId = locator.getSystemId();
}
private SAXLocation(Locator locator) {
lineNumber = locator.getLineNumber();
columnNumber = locator.getColumnNumber();
publicId = locator.getPublicId();
systemId = locator.getSystemId();
}
public int getColumnNumber() {
Locator l = findLocator();
if(l!=null) return l.getColumnNumber();
return -1;
}
public int getColumnNumber() {
Locator l = findLocator();
if(l!=null) return l.getColumnNumber();
return -1;
}
public int getColumnNumber() {
Locator l = findLocator();
if(l!=null) return l.getColumnNumber();
return -1;
}
public int getColumnNumber() {
Locator l = findLocator();
if(l!=null) return l.getColumnNumber();
return -1;
}
private SAXLocation(Locator locator) {
lineNumber = locator.getLineNumber();
columnNumber = locator.getColumnNumber();
publicId = locator.getPublicId();
systemId = locator.getSystemId();
}
private SAXLocation(Locator locator) {
lineNumber = locator.getLineNumber();
columnNumber = locator.getColumnNumber();
publicId = locator.getPublicId();
systemId = locator.getSystemId();
}
private SAXLocation(Locator locator) {
lineNumber = locator.getLineNumber();
columnNumber = locator.getColumnNumber();
publicId = locator.getPublicId();
systemId = locator.getSystemId();
}
public int getColumnNumber() {
Locator l = findLocator();
if(l!=null) return l.getColumnNumber();
return -1;
}
public int getColumnNumber() {
Locator l = findLocator();
if(l!=null) return l.getColumnNumber();
return -1;
}
public int getColumnNumber() {
Locator l = findLocator();
if(l!=null) return l.getColumnNumber();
return -1;
}
/**
* Constructs an object from an org.xml.sax.Locator.
*
* The object's ColumnNumber, LineNumber, and URL become available from the
* values returned by the locator's getColumnNumber(), getLineNumber(), and
* getSystemId() methods respectively. Node, Object, and Offset are not
* available.
*
* @param loc the SAX Locator object that will be used to populate this
* event locator.
* @throws IllegalArgumentException if the Locator is null
*/
public ValidationEventLocatorImpl( Locator loc ) {
if( loc == null ) {
throw new IllegalArgumentException(
Messages.format( Messages.MUST_NOT_BE_NULL, "loc" ) );
}
this.url = toURL(loc.getSystemId());
this.columnNumber = loc.getColumnNumber();
this.lineNumber = loc.getLineNumber();
}
/**
* Constructs an object from an org.xml.sax.Locator.
*
* The object's ColumnNumber, LineNumber, and URL become available from the
* values returned by the locator's getColumnNumber(), getLineNumber(), and
* getSystemId() methods respectively. Node, Object, and Offset are not
* available.
*
* @param loc the SAX Locator object that will be used to populate this
* event locator.
* @throws IllegalArgumentException if the Locator is null
*/
public ValidationEventLocatorImpl( Locator loc ) {
if( loc == null ) {
throw new IllegalArgumentException(
Messages.format( Messages.MUST_NOT_BE_NULL, "loc" ) );
}
this.url = toURL(loc.getSystemId());
this.columnNumber = loc.getColumnNumber();
this.lineNumber = loc.getLineNumber();
}
/**
* Constructs an object from an org.xml.sax.Locator.
*
* The object's ColumnNumber, LineNumber, and URL become available from the
* values returned by the locator's getColumnNumber(), getLineNumber(), and
* getSystemId() methods respectively. Node, Object, and Offset are not
* available.
*
* @param loc the SAX Locator object that will be used to populate this
* event locator.
* @throws IllegalArgumentException if the Locator is null
*/
public ValidationEventLocatorImpl( Locator loc ) {
if( loc == null ) {
throw new IllegalArgumentException(
Messages.format( Messages.MUST_NOT_BE_NULL, "loc" ) );
}
this.url = toURL(loc.getSystemId());
this.columnNumber = loc.getColumnNumber();
this.lineNumber = loc.getLineNumber();
}
/**
* Constructs an object from an org.xml.sax.Locator.
*
* The object's ColumnNumber, LineNumber, and URL become available from the
* values returned by the locator's getColumnNumber(), getLineNumber(), and
* getSystemId() methods respectively. Node, Object, and Offset are not
* available.
*
* @param loc the SAX Locator object that will be used to populate this
* event locator.
* @throws IllegalArgumentException if the Locator is null
*/
public ValidationEventLocatorImpl( Locator loc ) {
if( loc == null ) {
throw new IllegalArgumentException(
Messages.format( Messages.MUST_NOT_BE_NULL, "loc" ) );
}
this.url = toURL(loc.getSystemId());
this.columnNumber = loc.getColumnNumber();
this.lineNumber = loc.getLineNumber();
}