|
||||||||||
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 | |
class |
NamePool.NamePoolLimitException
The following code is used to create a list of Java declarations for the fingerprints of standard names used in a stylesheet. |
Field Summary | |
(package private) net.sf.saxon.om.NamePool.NameEntry[] |
hashslots
|
(package private) String[] |
prefixes
|
(package private) String[] |
prefixesForUri
|
(package private) short |
prefixesUsed
|
(package private) String[] |
uris
|
(package private) short |
urisUsed
|
Constructor Summary | |
NamePool()
|
Method Summary | |
void |
addAttributeDeclaration(int fingerprint,
SchemaComponentMarker attribute)
Add an attribute declaration to the name pool This method is used only in the schema-aware product. |
void |
addElementDeclaration(int fingerprint,
SchemaComponentMarker element)
Add an element declaration to the name pool This method is used only in the schema-aware product. |
void |
addSchemaType(int fingerprint,
SchemaType type)
Add a SchemaType to the name pool |
int |
allocate(String prefix,
short uriCode,
String localName)
Allocate a name from the pool, or a new Name if there is not a matching one there |
int |
allocate(String prefix,
String uri,
String localName)
Allocate a name from the pool, or a new Name if there is not a matching one there |
int |
allocateClarkName(String expandedName)
Allocate a fingerprint given a Clark Name |
short |
allocateCodeForPrefix(String prefix)
Allocate the prefix code for a given Prefix; create one if not found |
short |
allocateCodeForURI(String uri)
Allocate the uri code for a given URI; create one if not found |
int |
allocateDocumentNumber(DocumentInfo doc)
Add a document to the pool, and allocate a document number |
int |
allocateNamespaceCode(int namecode)
Allocate a namespace code for the prefix/URI of a given namecode |
int |
allocateNamespaceCode(String prefix,
String uri)
Allocate the namespace code for a namespace prefix/URI pair. |
void |
diagnosticDump()
Diagnostic print of the namepool contents. |
SchemaComponentMarker |
getAttributeDeclaration(int fingerprint)
Get a global attribute declaration |
String |
getClarkName(int nameCode)
Get the Clark form of a name, given its name code or fingerprint |
short |
getCodeForPrefix(String prefix)
Get the prefix code for a given Prefix |
short |
getCodeForURI(String uri)
Get the uri code for a given URI |
static NamePool |
getDefaultNamePool()
Get the singular default NamePool |
String |
getDisplayName(int nameCode)
Get the display form of a name (the QName), given its name code or fingerprint |
SchemaComponentMarker |
getElementDeclaration(int fingerprint)
Get a global element declaration |
int |
getFingerprint(String uri,
String localName)
Get a fingerprint for the name with a given uri and local name. |
int |
getFingerprintForExpandedName(String expandedName)
Get fingerprint for expanded name in {uri}local format |
String |
getLocalName(int nameCode)
Get the local part of a name, given its name code or fingerprint |
int |
getNamespaceCode(String prefix,
String uri)
Get the existing namespace code for a namespace prefix/URI pair. |
String |
getPrefix(int nameCode)
Get the prefix part of a name, given its name code or fingerprint |
String |
getPrefixFromNamespaceCode(int code)
Get the namespace prefix from a namespace code. |
String |
getPrefixWithIndex(short uriCode,
int index)
Get a prefix among all the prefixes used with a given URI, given its index |
SchemaType |
getSchemaType(int fingerprint)
Get the schema type with a given name. |
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 |
String |
getURIFromNamespaceCode(int code)
Get the namespace URI from a namespace code. |
String |
getURIFromURICode(short code)
Get the namespace URI from a URI code. |
void |
removeAttributeDeclaration(int fingerprint)
Remove an attribute declaration from the name pool. |
void |
removeElementDeclaration(int fingerprint)
Remove an element declaration from the name pool. |
void |
removeSchemaType(int fingerprint)
Remove a SchemaType from the name pool |
static void |
setDefaultNamePool(NamePool pool)
Set the default NamePool (used after loading a compiled stylesheet) |
String |
suggestPrefixForURI(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 |
net.sf.saxon.om.NamePool.NameEntry[] hashslots
String[] prefixes
short prefixesUsed
String[] uris
String[] prefixesForUri
short urisUsed
Constructor Detail |
public NamePool()
Method Detail |
public static NamePool getDefaultNamePool()
public static void setDefaultNamePool(NamePool pool)
public int allocateDocumentNumber(DocumentInfo doc)
doc
- The DocumentInfo for the document in question
public int allocateNamespaceCode(String prefix, String uri)
prefix
- the namespace prefixuri
- the namespace URI
public int getNamespaceCode(String prefix, String uri)
public short allocateCodeForURI(String uri)
public short getCodeForURI(String uri)
public short allocateCodeForPrefix(String prefix)
prefix
- the namespace prefix whose code is to be allocated or returned
public short getCodeForPrefix(String prefix)
public String suggestPrefixForURI(String URI)
public String getPrefixWithIndex(short uriCode, int index)
public int allocate(String prefix, String uri, String localName)
prefix
- uri
- - the namespace URIlocalName
-
public int allocate(String prefix, short uriCode, String localName)
prefix
- uriCode
- - the code of the URIlocalName
-
public int allocateNamespaceCode(int namecode)
namecode
- a code identifying an expanded QName, e.g. of an element or attribute
public String getURI(int nameCode)
public short getURICode(int nameCode)
public String getLocalName(int nameCode)
public String getPrefix(int nameCode)
public String getDisplayName(int nameCode)
public String getClarkName(int nameCode)
public int allocateClarkName(String expandedName)
public int getFingerprint(String uri, String localName)
public String getURIFromNamespaceCode(int code)
public String getURIFromURICode(short code)
public String getPrefixFromNamespaceCode(int code)
public int getFingerprintForExpandedName(String expandedName)
public void addSchemaType(int fingerprint, SchemaType type)
public void removeSchemaType(int fingerprint)
public SchemaType getSchemaType(int fingerprint)
public void addElementDeclaration(int fingerprint, SchemaComponentMarker element)
public void removeElementDeclaration(int fingerprint)
public SchemaComponentMarker getElementDeclaration(int fingerprint)
public void addAttributeDeclaration(int fingerprint, SchemaComponentMarker attribute)
public void removeAttributeDeclaration(int fingerprint)
public SchemaComponentMarker getAttributeDeclaration(int fingerprint)
public void diagnosticDump()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |