Java Code Examples for org.xml.sax.Locator#getColumnNumber()

The following examples show how to use org.xml.sax.Locator#getColumnNumber() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlLocationAnnotator.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example 2
Source File: XmlLocationAnnotator.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example 3
Source File: Util.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example 4
Source File: DOMForestScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public int getColumnNumber() {
    Locator l = findLocator();
    if(l!=null)     return l.getColumnNumber();
    return          -1;
}
 
Example 5
Source File: SAX2StAXBaseWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private SAXLocation(Locator locator) {
        lineNumber = locator.getLineNumber();
        columnNumber = locator.getColumnNumber();
        publicId = locator.getPublicId();
        systemId = locator.getSystemId();
}
 
Example 6
Source File: DOMForestScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public int getColumnNumber() {
    Locator l = findLocator();
    if(l!=null)     return l.getColumnNumber();
    return          -1;
}
 
Example 7
Source File: DOMForestScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public int getColumnNumber() {
    Locator l = findLocator();
    if(l!=null)     return l.getColumnNumber();
    return          -1;
}
 
Example 8
Source File: SAX2StAXBaseWriter.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private SAXLocation(Locator locator) {
        lineNumber = locator.getLineNumber();
        columnNumber = locator.getColumnNumber();
        publicId = locator.getPublicId();
        systemId = locator.getSystemId();
}
 
Example 9
Source File: SAX2StAXBaseWriter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private SAXLocation(Locator locator) {
        lineNumber = locator.getLineNumber();
        columnNumber = locator.getColumnNumber();
        publicId = locator.getPublicId();
        systemId = locator.getSystemId();
}
 
Example 10
Source File: SAX2StAXBaseWriter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private SAXLocation(Locator locator) {
        lineNumber = locator.getLineNumber();
        columnNumber = locator.getColumnNumber();
        publicId = locator.getPublicId();
        systemId = locator.getSystemId();
}
 
Example 11
Source File: DOMForestScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public int getColumnNumber() {
    Locator l = findLocator();
    if(l!=null)     return l.getColumnNumber();
    return          -1;
}
 
Example 12
Source File: DOMForestScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public int getColumnNumber() {
    Locator l = findLocator();
    if(l!=null)     return l.getColumnNumber();
    return          -1;
}
 
Example 13
Source File: DOMForestScanner.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public int getColumnNumber() {
    Locator l = findLocator();
    if(l!=null)     return l.getColumnNumber();
    return          -1;
}
 
Example 14
Source File: DOMForestScanner.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public int getColumnNumber() {
    Locator l = findLocator();
    if(l!=null)     return l.getColumnNumber();
    return          -1;
}
 
Example 15
Source File: SAX2StAXBaseWriter.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private SAXLocation(Locator locator) {
        lineNumber = locator.getLineNumber();
        columnNumber = locator.getColumnNumber();
        publicId = locator.getPublicId();
        systemId = locator.getSystemId();
}
 
Example 16
Source File: SAX2StAXBaseWriter.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private SAXLocation(Locator locator) {
        lineNumber = locator.getLineNumber();
        columnNumber = locator.getColumnNumber();
        publicId = locator.getPublicId();
        systemId = locator.getSystemId();
}
 
Example 17
Source File: ValidationEventLocatorImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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();
}
 
Example 18
Source File: ValidationEventLocatorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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();
}
 
Example 19
Source File: ValidationEventLocatorImpl.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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();
}
 
Example 20
Source File: ValidationEventLocatorImpl.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * 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();
}