The Locator2 Interface
SAX 2.0.2 adds a Locator2
subclass of Locator
that provides extra methods to
determine the character encoding and XML version used by the
current entity. A parser that supports Locator2
will simply pass a Locator2
object to setLocator( )
instead of a plain
Locator
object. Using the extra
methods requires a cast. Before casting, you may wish to check
whether the cast will succeed by getting the value of the http://xml.org/sax/features/use-locator2
feature. If this feature is true, the parser passes Locator2
objects.
package org.xml.sax.ext; public interfaceEntityResolver2
{ public StringgetXMLVersion
( ); public StringgetEncoding
( ); }
The getXMLVersion( )
method returns the version of the current
entity. The http://xml.org/sax/properties/document-xml-version
property returns the version of the current
document. These may be but do not have to
be the same.