Package com.fasterxml.aalto.out
Class NsBinder
- java.lang.Object
-
- com.fasterxml.aalto.out.NsBinder
-
final class NsBinder extends java.lang.Object
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
Fields Modifier and Type Field Description (package private) java.lang.String[]
_nsStrings
Array that contains { prefix, ns-uri } pairs, up to (but not including) index_scopeEnd
.(package private) int
_scopeEnd
(package private) int
_scopeStart
(package private) static int
DEFAULT_ARRAY_SIZE
Let's plan for having up to 14 explicit namespace declarations (in addition to 2 defaults, 'xml' and 'xmlns')
-
Constructor Summary
Constructors Modifier Constructor Description private
NsBinder(int scopeStart, java.lang.String[] strs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.String
addMapping(java.lang.String prefix, java.lang.String uri)
Method to add a new prefix-to-URI mapping for the current scope.NsBinder
createChild()
static NsBinder
createEmpty()
java.lang.String
findPrefixByUri(java.lang.String uri)
java.lang.String
findUriByPrefix(java.lang.String prefix)
(package private) java.lang.String
generatePrefix(java.lang.String prefixBase, javax.xml.namespace.NamespaceContext ctxt, int[] seqArr)
Method used to generate a new prefix that does not conflict with an existing bound prefix.java.util.List<java.lang.String>
getPrefixesBoundToUri(java.lang.String uri, java.util.List<java.lang.String> l)
int
localSize()
int
size()
java.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_ARRAY_SIZE
static final int DEFAULT_ARRAY_SIZE
Let's plan for having up to 14 explicit namespace declarations (in addition to 2 defaults, 'xml' and 'xmlns')- See Also:
- Constant Field Values
-
_scopeStart
final int _scopeStart
-
_nsStrings
java.lang.String[] _nsStrings
Array that contains { prefix, ns-uri } pairs, up to (but not including) index_scopeEnd
.
-
_scopeEnd
int _scopeEnd
-
-
Method Detail
-
createEmpty
public static NsBinder createEmpty()
-
createChild
public NsBinder createChild()
-
findUriByPrefix
public java.lang.String findUriByPrefix(java.lang.String prefix)
-
findPrefixByUri
public java.lang.String findPrefixByUri(java.lang.String uri)
-
getPrefixesBoundToUri
public java.util.List<java.lang.String> getPrefixesBoundToUri(java.lang.String uri, java.util.List<java.lang.String> l)
-
size
public int size()
-
localSize
public int localSize()
-
addMapping
java.lang.String addMapping(java.lang.String prefix, java.lang.String uri)
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
java.lang.String generatePrefix(java.lang.String prefixBase, javax.xml.namespace.NamespaceContext ctxt, int[] seqArr)
Method used to generate a new prefix that does not conflict with an existing bound prefix.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-