Code example for Locator

Methods: getColumnNumber, getLineNumber

0
     * @return the current parsing location in string format " (at line %d, column %d)". 
     */ 
    private String getCurrentLocation()
    { 
        if (locator != null) {
            return String.format(" (at line %d, column %d)", locator.getLineNumber(), locator.getColumnNumber());
        } else { 
            return " (Unknown location)"; 
        } 
    } 
 
    @Override 
    public String getLocatedMessage(String format, Object... objects)
    { 
        return String.format(format, objects) + getCurrentLocation();
    } 
 
    @Override 
    public void warning(SAXParseException e) throws SAXException
    { 
        throw new SAXException(e.getLocalizedMessage(), e);