Skip to Content
Java in a Nutshell, 5th Edition
book

Java in a Nutshell, 5th Edition

by David Flanagan
March 2005
Intermediate to advanced
1254 pages
104h 21m
English
O'Reilly Media, Inc.
Content preview from Java in a Nutshell, 5th Edition

Name

Locator

Synopsis

A XMLReader may pass an object that implements this interface to the application by calling the setDocumentLocator( ) method of the application’s ContentHandler object before it invokes any other methods of that ContentHandler. The ContentHandler can use methods of this Locator object from within any of the other methods called by the parser in order to determine what document the parser is parsing and what line number and column number it is parsing at. This information is particularly useful when displaying error or warning messages, for example. getSystemId( ) and getPublicId( ) return the system and public identifiers of the document being parsed, if this information is available to the parser, and otherwise return null. getLineNumber( ) and getColumnNumber( ) return the line number and column number of the next character that the parser will read (line and column numbers are numbered starting at 1, not at 0). The parser is allowed to return an approximate value from these methods, or to return -1 if it does not track line and column numbers.

public interface Locator {
// Public Instance Methods
     int getColumnNumber( );  
     int getLineNumber( );  
     String getPublicId( );  
     String getSystemId( );  
}

Implementations

org.xml.sax.ext.Locator2, org.xml.sax.helpers.LocatorImpl

Passed To

org.xml.sax.ContentHandler.setDocumentLocator( ), DocumentHandler.setDocumentLocator( ), HandlerBase.setDocumentLocator( ), SAXParseException.SAXParseException( ), org.xml.sax.ext.Locator2Impl.Locator2Impl( ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java in a Nutshell, 8th Edition

Java in a Nutshell, 8th Edition

Benjamin J. Evans, Jason Clark, David Flanagan
Java in a Nutshell, 7th Edition

Java in a Nutshell, 7th Edition

Benjamin J. Evans, David Flanagan
Learning Java, 5th Edition

Learning Java, 5th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
Learning Java, 4th Edition

Learning Java, 4th Edition

Patrick Niemeyer, Daniel Leuck

Publisher Resources

ISBN: 0596007736Supplemental ContentErrata Page