|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.om.NamePool
An object representing a collection of XML names, each containing a Namespace URI,
a Namespace prefix, and a local name; plus a collection of namespaces, each
consisting of a prefix/URI pair.
The equivalence betweem names depends only on the URI and the local name. The prefix is retained for documentary purposes only: it is useful when reconstructing a document to use prefixes that the user is familiar with.
The NamePool eliminates duplicate names if they have the same prefix, uri, and local part. It retains duplicates if they have different prefixes
Nested Class Summary | |
static class |
NamePool.NamePoolLimitException
|
Field Summary | |
static int |
FP_MASK
FP_MASK is a mask used to obtain a fingerprint from a nameCode. |
static int |
MAX_PREFIXES_PER_URI
|
Constructor Summary | |
NamePool()
|
Method Summary | |
int |
allocate(java.lang.String prefix,
short uriCode,
java.lang.String localName)
Allocate a name from the pool, or a new Name if there is not a matching one there |
int |
allocate(java.lang.String prefix,
java.lang.String uri,
java.lang.String localName)
Allocate a name from the pool, or a new Name if there is not a matching one there |
int |
allocateClarkName(java.lang.String expandedName)
Allocate a fingerprint given a Clark Name |
short |
allocateCodeForURI(java.lang.String uri)
Allocate the uri code for a given URI; create one if not found |
int |
allocateLexicalQName(java.lang.CharSequence qname,
boolean useDefault,
NamespaceResolver resolver,
NameChecker checker)
Get the nameCode for a lexical QName, given a namespace resolver. |
int |
allocateNamespaceCode(int namecode)
Allocate a namespace code for the prefix/URI of a given namecode |
int |
allocateNamespaceCode(java.lang.String prefix,
java.lang.String uri)
Allocate the namespace code for a namespace prefix/URI pair. |
void |
diagnosticDump()
Diagnostic print of the namepool contents. |
java.lang.String |
getClarkName(int nameCode)
Get the Clark form of a name, given its name code or fingerprint |
java.lang.Object |
getClientData(java.lang.Class key)
Retrieve client data on behalf of a user of the namepool |
short |
getCodeForPrefix(java.lang.String prefix)
Get the prefix code for a given Prefix |
short |
getCodeForURI(java.lang.String uri)
Get the uri code for a given URI |
static NamePool |
getDefaultNamePool()
Get the singular default NamePool |
java.lang.String |
getDisplayName(int nameCode)
Get the display form of a name (the QName), given its name code or fingerprint |
int |
getFingerprint(java.lang.String uri,
java.lang.String localName)
Get a fingerprint for the name with a given uri and local name. |
int |
getFingerprintForExpandedName(java.lang.String expandedName)
Get fingerprint for expanded name in {uri}local format |
java.lang.String |
getLocalName(int nameCode)
Get the local part of a name, given its name code or fingerprint |
int |
getNamespaceCode(int namecode)
Allocate a namespace code for a given namecode |
int |
getNamespaceCode(java.lang.String prefix,
java.lang.String uri)
Get the existing namespace code for a namespace prefix/URI pair. |
java.lang.String |
getPrefix(int nameCode)
Get the prefix part of a name, given its name code or fingerprint |
java.lang.String |
getPrefixFromNamespaceCode(int code)
Get the namespace prefix from a namespace code. |
java.lang.String |
getPrefixWithIndex(short uriCode,
int index)
Get a prefix among all the prefixes used with a given URI, given its index |
TypeHierarchy |
getTypeHierarchy()
Get the TypeHierarchy |
java.lang.String |
getURI(int nameCode)
Get the namespace-URI of a name, given its name code or fingerprint |
short |
getURICode(int nameCode)
Get the URI code of a name, given its name code or fingerprint |
java.lang.String |
getURIFromNamespaceCode(int code)
Get the namespace URI from a namespace code. |
java.lang.String |
getURIFromURICode(short code)
Get the namespace URI from a URI code. |
static java.lang.String[] |
parseClarkName(java.lang.String expandedName)
Parse a Clark-format expanded name, returning the URI and local name |
void |
setClientData(java.lang.Class key,
java.lang.Object value)
Save client data on behalf of a user of the namepool |
static void |
setDefaultNamePool(NamePool pool)
Set the default NamePool (used after loading a compiled stylesheet) |
void |
statistics()
Statistics summarizing the namepool contents. |
java.lang.String |
suggestPrefixForURI(java.lang.String URI)
Suggest a prefix for a given URI. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int FP_MASK
nc & NamePool.FP_MASK
.
(In practice, Saxon code often uses the literal constant 0xfffff.)
The difference between a nameCode is that a nameCode contains information
about the prefix of a name, the fingerprint depends only on the namespace
URI and local name. Note that the "null" nameCode (-1) does not produce
the "null" fingerprint (also -1) when this mask is applied.
public static final int MAX_PREFIXES_PER_URI
Constructor Detail |
public NamePool()
Method Detail |
public static NamePool getDefaultNamePool()
public static void setDefaultNamePool(NamePool pool)
public final TypeHierarchy getTypeHierarchy()
public int allocateNamespaceCode(java.lang.String prefix, java.lang.String uri)
prefix
- the namespace prefixuri
- the namespace URI
public int getNamespaceCode(java.lang.String prefix, java.lang.String uri)
public int getNamespaceCode(int namecode)
namecode
- a code identifying an expanded QName, e.g. of an element or attribute
public short allocateCodeForURI(java.lang.String uri)
public short getCodeForURI(java.lang.String uri)
public short getCodeForPrefix(java.lang.String prefix)
public java.lang.String suggestPrefixForURI(java.lang.String URI)
public java.lang.String getPrefixWithIndex(short uriCode, int index)
public int allocate(java.lang.String prefix, java.lang.String uri, java.lang.String localName)
prefix
- uri
- - the namespace URI. The null URI is represented as an empty string.localName
-
public int allocate(java.lang.String prefix, short uriCode, java.lang.String localName)
prefix
- - the namespace prefixuriCode
- - the code of the URIlocalName
- - the local part of the QName
public int allocateNamespaceCode(int namecode)
namecode
- a code identifying an expanded QName, e.g. of an element or attribute
public java.lang.String getURI(int nameCode)
public short getURICode(int nameCode)
public java.lang.String getLocalName(int nameCode)
public java.lang.String getPrefix(int nameCode)
public java.lang.String getDisplayName(int nameCode)
public java.lang.String getClarkName(int nameCode)
public int allocateClarkName(java.lang.String expandedName)
public static java.lang.String[] parseClarkName(java.lang.String expandedName)
public int getFingerprint(java.lang.String uri, java.lang.String localName)
public java.lang.String getURIFromNamespaceCode(int code)
public java.lang.String getURIFromURICode(short code)
public java.lang.String getPrefixFromNamespaceCode(int code)
public int allocateLexicalQName(java.lang.CharSequence qname, boolean useDefault, NamespaceResolver resolver, NameChecker checker) throws DynamicError
qname
- the lexical QName.useDefault
- if true, an absent prefix is resolved by the NamespaceResolver
to the namespace URI assigned to the prefix "". If false, an absent prefix is
interpreted as meaning the name is in no namespace.checker
- NameChecker used to check names against the XML 1.0 or 1.1 specification
DynamicError
- if the string is not a valid lexical QName or
if the namespace prefix has not been declared*public int getFingerprintForExpandedName(java.lang.String expandedName)
public void setClientData(java.lang.Class key, java.lang.Object value)
public java.lang.Object getClientData(java.lang.Class key)
public void diagnosticDump()
public void statistics()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |