Top Description Fields Constructors Methods
com.fasterxml.aalto.out

pack-priv final Class NsBinder

extends Object
Class Inheritance
Imports
java.util.*, javax.xml.XMLConstants, javax.xml.namespace.NamespaceContext

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

Modifier and TypeField and Description
pack-priv String[]
_nsStrings

Array that contains { prefix, ns-uri } pairs, up to (but not including) index _scopeEnd.

pack-priv int
pack-priv final int
pack-priv 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')

Constructor Summary

AccessConstructor and Description
private
NsBinder(int scopeStart, String[] strs)

Method Summary

Modifier and TypeMethod and Description
pack-priv String

Returns:

If the prefix was already bound, the URI it was bound to: null if it's a new binding for the current scope.
addMapping
(String
Prefix to bind
prefix
,
String
URI to bind to the prefix
uri
)

Method to add a new prefix-to-URI mapping for the current scope.

public NsBinder
public static NsBinder
public String
public String
pack-priv String
generatePrefix(String prefixBase, NamespaceContext ctxt, int[] seqArr)

Method used to generate a new prefix that does not conflict with an existing bound prefix.

public List<String>
public int
public int
size()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_nsStringsback to summary
pack-priv String[] _nsStrings

Array that contains { prefix, ns-uri } pairs, up to (but not including) index _scopeEnd.

_scopeEndback to summary
pack-priv int _scopeEnd
_scopeStartback to summary
pack-priv final int _scopeStart
DEFAULT_ARRAY_SIZEback to summary
pack-priv 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')

Constructor Detail

NsBinderback to summary
private NsBinder(int scopeStart, String[] strs)

Method Detail

addMappingback to summary
pack-priv String addMapping(String prefix, 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:String

Prefix to bind

uri:String

URI to bind to the prefix

Returns:String

If the prefix was already bound, the URI it was bound to: null if it's a new binding for the current scope.

createChildback to summary
public NsBinder createChild()
createEmptyback to summary
public static NsBinder createEmpty()
findPrefixByUriback to summary
public String findPrefixByUri(String uri)
findUriByPrefixback to summary
public String findUriByPrefix(String prefix)
generatePrefixback to summary
pack-priv String generatePrefix(String prefixBase, NamespaceContext ctxt, int[] seqArr)

Method used to generate a new prefix that does not conflict with an existing bound prefix.

getPrefixesBoundToUriback to summary
public List<String> getPrefixesBoundToUri(String uri, List<String> l)
localSizeback to summary
public int localSize()
sizeback to summary
public int size()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override