Code example for Locator

Methods: getColumnNumber, getLineNumber, getSystemId

0
 
    public void setDocumentLocator(Locator locator)
    { 
      this.locator = locator;
      location = new LocationImpl(-1,
                                  locator.getColumnNumber(),
                                  locator.getLineNumber(),
                                  locator.getSystemId());
    } 
 
    public void startDocument() 
      throws SAXException 
    { 
      String version = (locator instanceof Locator2) ?
        ((Locator2) locator).getXMLVersion() : null;
      String encoding = (locator instanceof Locator2) ? 
        ((Locator2) locator).getEncoding() : null;
      boolean standalone =
        reader.getFeature("http://xml.org/sax/features/is-standalone");
      boolean standaloneDeclared = standalone;
      boolean encodingDeclared = (encoding != null);