SourceLocator


SourceLocator javax.xml.transform

Java 1.4

This interface defines methods that return the system and public identifiers of an XML document, and return a line number and column number within that document. SourceLocator objects are used with transformerException and TRansformerConfigurationException objects to specify the location in an XML file at which the exception occurred. Note, however that system and public identifiers are not always available for a document, and so getSystemId( ) and getPublicId( ) may return null . Also, a tranformer is not required to track line and column numbers precisely, or at all, so getLineNumber( ) and getColumnNumber( ) may return -1 to indicate that line and column number information is not available. If they return a value other than -1, it should be considered an approximation to the actual value. Note that lines and columns within a document are numbered starting with 1, not with 0.

If you are familiar with the SAX API for parsing XML, you'll recognize this interface as a renamed version of org.xml.sax.Locator .

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

Implementations

javax.xml.transform.dom.DOMLocator

Passed To

transformerConfigurationException.TransformerConfigurationException( ) , transformerException.{setLocator( ) , transformerException( )}

Returned By

transformerException.getLocator( )



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net