Package com.fasterxml.aalto.dom
Class BijectiveNsMap
java.lang.Object
com.fasterxml.aalto.dom.BijectiveNsMap
Helper class that implements "bijective map" (Map that allows use of values
as keys and vice versa, bidirectional access), and is specifically
used for storing namespace binding information.
One thing worth noting is that Strings stored are NOT assumed to have
been unified (interned) -- if they were, different implementation would
be more optimal.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) String[]
Array that contains { prefix, ns-uri } pairs, up to (but not including) index_scopeEnd
.(package private) int
(package private) final int
(package private) static final int
Let's plan for having up to 14 explicit namespace declarations (2 defaults, for 'xml' and 'xmlns', are pre-populated) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddGeneratedMapping
(String prefixBase, NamespaceContext ctxt, String uri, int[] seqArr) Method used to add a dynamic binding, and return the prefix used to bind the specified namespace URI.addMapping
(String prefix, String uri) Method to add a new prefix-to-URI mapping for the current scope.static BijectiveNsMap
findPrefixByUri
(String uri) findUriByPrefix
(String prefix) getPrefixesBoundToUri
(String uri, List<String> l) int
int
size()
-
Field Details
-
DEFAULT_ARRAY_SIZE
static final int DEFAULT_ARRAY_SIZELet's plan for having up to 14 explicit namespace declarations (2 defaults, for 'xml' and 'xmlns', are pre-populated)- See Also:
-
_scopeStart
final int _scopeStart -
_nsStrings
String[] _nsStringsArray that contains { prefix, ns-uri } pairs, up to (but not including) index_scopeEnd
. -
_scopeEnd
int _scopeEnd
-
-
Constructor Details
-
BijectiveNsMap
-
-
Method Details
-
createEmpty
-
createChild
-
findUriByPrefix
-
findPrefixByUri
-
getPrefixesBoundToUri
-
size
public int size() -
localSize
public int localSize() -
addMapping
Method to add a new prefix-to-URI mapping for the current scope. Note that it should NOT be used for the default namespace declaration- Parameters:
prefix
- Prefix to binduri
- URI to bind to the prefix- Returns:
- If the prefix was already bound, the URI it was bound to: null if it's a new binding for the current scope.
-
addGeneratedMapping
public String addGeneratedMapping(String prefixBase, NamespaceContext ctxt, String uri, int[] seqArr) Method used to add a dynamic binding, and return the prefix used to bind the specified namespace URI.
-