Stay organized with collections
Save and categorize content based on your preferences.
Locator2
public
interface
Locator2
implements
Locator
Known indirect subclasses
Locator2Impl |
SAX2 extension helper for holding additional Entity information,
implementing the Locator2 interface.
|
|
SAX2 extension to augment the entity information provided
though a Locator
.
If an implementation supports this extension, the Locator
provided in ContentHandler.setDocumentLocator()
will implement this
interface, and the
http://xml.org/sax/features/use-locator2 feature
flag will have the value true.
This module, both source code and documentation, is in the
Public Domain, and comes with NO WARRANTY.
XMLReader implementations are not required to support this
information, and it is not part of core-only SAX2 distributions.
Summary
Public methods |
abstract
String
|
getEncoding()
Returns the name of the character encoding for the entity.
|
abstract
String
|
getXMLVersion()
Returns the version of XML used for the entity.
|
Public methods
getEncoding
public abstract String getEncoding ()
Returns the name of the character encoding for the entity.
If the encoding was declared externally (for example, in a MIME
Content-Type header), that will be the name returned. Else if there
was an <?xml ...encoding='...'?> declaration at
the start of the document, that encoding name will be returned.
Otherwise the encoding will been inferred (normally to be UTF-8, or
some UTF-16 variant), and that inferred name will be returned.
When an InputSource
is used
to provide an entity's character stream, this method returns the
encoding provided in that input stream.
Note that some recent W3C specifications require that text
in some encodings be normalized, using Unicode Normalization
Form C, before processing. Such normalization must be performed
by applications, and would normally be triggered based on the
value returned by this method.
Encoding names may be those used by the underlying JVM,
and comparisons should be case-insensitive.
Returns |
String |
Name of the character encoding being used to interpret
* the entity's text, or null if this was not provided for a *
character stream passed through an InputSource or is otherwise
not yet available in the current parsing state. |
getXMLVersion
public abstract String getXMLVersion ()
Returns the version of XML used for the entity. This will
normally be the identifier from the current entity's
<?xml version='...' ...?> declaration,
or be defaulted by the parser.
Returns |
String |
Identifier for the XML version being used to interpret
the entity's text, or null if that information is not yet
available in the current parsing state. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Locator2\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nLocator2\n========\n\n\n`\npublic\n\n\ninterface\nLocator2\n`\n\n\n`\n\n\nimplements\n\n`[Locator](/reference/org/xml/sax/Locator)`\n\n\n`\n\n|--------------------------|\n| org.xml.sax.ext.Locator2 |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [Locator2Impl](/reference/org/xml/sax/ext/Locator2Impl) |---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------| | [Locator2Impl](/reference/org/xml/sax/ext/Locator2Impl) | SAX2 extension helper for holding additional Entity information, implementing the [Locator2](/reference/org/xml/sax/ext/Locator2) interface. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nSAX2 extension to augment the entity information provided\nthough a [Locator](/reference/org/xml/sax/Locator).\nIf an implementation supports this extension, the Locator\nprovided in [ContentHandler.setDocumentLocator()](/reference/org/xml/sax/ContentHandler#setDocumentLocator(org.xml.sax.Locator)) will implement this\ninterface, and the\n*http://xml.org/sax/features/use-locator2* feature\nflag will have the value *true*.\n\n\u003e *This module, both source code and documentation, is in the\n\u003e Public Domain, and comes with **NO WARRANTY**.*\n\nXMLReader implementations are not required to support this\ninformation, and it is not part of core-only SAX2 distributions.\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract `[String](/reference/java/lang/String) | ` `[getEncoding](/reference/org/xml/sax/ext/Locator2#getEncoding())`() ` Returns the name of the character encoding for the entity. |\n| ` abstract `[String](/reference/java/lang/String) | ` `[getXMLVersion](/reference/org/xml/sax/ext/Locator2#getXMLVersion())`() ` Returns the version of XML used for the entity. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[org.xml.sax.Locator](/reference/org/xml/sax/Locator)` ` |---------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int` | ` `[getColumnNumber](/reference/org/xml/sax/Locator#getColumnNumber())`() ` Return the column number where the current document event ends. | | ` abstract int` | ` `[getLineNumber](/reference/org/xml/sax/Locator#getLineNumber())`() ` Return the line number where the current document event ends. | | ` abstract `[String](/reference/java/lang/String) | ` `[getPublicId](/reference/org/xml/sax/Locator#getPublicId())`() ` Return the public identifier for the current document event. | | ` abstract `[String](/reference/java/lang/String) | ` `[getSystemId](/reference/org/xml/sax/Locator#getSystemId())`() ` Return the system identifier for the current document event. | ||\n\nPublic methods\n--------------\n\n### getEncoding\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract String getEncoding ()\n```\n\nReturns the name of the character encoding for the entity.\nIf the encoding was declared externally (for example, in a MIME\nContent-Type header), that will be the name returned. Else if there\nwas an *\\\u003c?xml ...encoding='...'?\\\u003e* declaration at\nthe start of the document, that encoding name will be returned.\nOtherwise the encoding will been inferred (normally to be UTF-8, or\nsome UTF-16 variant), and that inferred name will be returned.\n\nWhen an [InputSource](/reference/org/xml/sax/InputSource) is used\nto provide an entity's character stream, this method returns the\nencoding provided in that input stream.\n\nNote that some recent W3C specifications require that text\nin some encodings be normalized, using Unicode Normalization\nForm C, before processing. Such normalization must be performed\nby applications, and would normally be triggered based on the\nvalue returned by this method.\n\nEncoding names may be those used by the underlying JVM,\nand comparisons should be case-insensitive.\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [String](/reference/java/lang/String) | Name of the character encoding being used to interpret \\* the entity's text, or null if this was not provided for a \\* character stream passed through an InputSource or is otherwise not yet available in the current parsing state. \u003cbr /\u003e |\n\n### getXMLVersion\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract String getXMLVersion ()\n```\n\nReturns the version of XML used for the entity. This will\nnormally be the identifier from the current entity's\n*\\\u003c?xml version='...' ...?\\\u003e* declaration,\nor be defaulted by the parser.\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [String](/reference/java/lang/String) | Identifier for the XML version being used to interpret the entity's text, or null if that information is not yet available in the current parsing state. \u003cbr /\u003e |"]]