Package com.fasterxml.aalto.out
Class NsBinder
java.lang.Object
com.fasterxml.aalto.out.NsBinder
Simple helper class to allow resolving of namespace bindings either
from prefix to URI, or vice versa.
Note: unlike with input side resolvers, here we can not assume that prefixes or URIs given are canonicalized (interned), and identity comparison can not be used exclusively.
-
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 (in addition to 2 defaults, 'xml' and 'xmlns') -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) String
addMapping
(String prefix, String uri) Method to add a new prefix-to-URI mapping for the current scope.static NsBinder
findPrefixByUri
(String uri) findUriByPrefix
(String prefix) (package private) String
generatePrefix
(String prefixBase, NamespaceContext ctxt, int[] seqArr) Method used to generate a new prefix that does not conflict with an existing bound prefix.getPrefixesBoundToUri
(String uri, List<String> l) int
int
size()
toString()
-
Field Details
-
DEFAULT_ARRAY_SIZE
static final int DEFAULT_ARRAY_SIZELet's plan for having up to 14 explicit namespace declarations (in addition to 2 defaults, 'xml' and 'xmlns')- 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
-
NsBinder
-
-
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.
-
generatePrefix
Method used to generate a new prefix that does not conflict with an existing bound prefix. -
toString
-