SourceLocator | javax.xml.transform |
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( )
|