|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ctc.wstx.sw.OutputElementBase
public abstract class OutputElementBase
Class that encapsulates information about a specific element in virtual output stack for namespace-aware writers. It provides support for URI-to-prefix mappings as well as namespace mapping generation.
One noteworthy feature of the class is that it is designed to allow "short-term recycling", ie. instances can be reused within context of a simple document output. While reuse/recycling of such lightweight object is often useless or even counter productive, here it may be worth using, due to simplicity of the scheme (basically using a very simple free-elements linked list).
Field Summary | |
---|---|
protected String |
mDefaultNsURI
|
protected BijectiveNsMap |
mNsMapping
Mapping of namespace prefixes to URIs and back. |
protected boolean |
mNsMapShared
True, if mNsMapping is a shared copy from the parent;
false if a local copy was created (which happens when namespaces
get bound etc). |
protected NamespaceContext |
mRootNsContext
Namespace context end application may have supplied, and that (if given) should be used to augment explicitly defined bindings. |
static int |
PREFIX_MISBOUND
|
static int |
PREFIX_OK
|
static int |
PREFIX_UNBOUND
|
Constructor Summary | |
---|---|
protected |
OutputElementBase()
Constructor for the virtual root element |
protected |
OutputElementBase(OutputElementBase parent,
BijectiveNsMap ns)
|
Method Summary | |
---|---|
void |
addPrefix(String prefix,
String uri)
|
String |
generateMapping(String prefixBase,
String uri,
int[] seqArr)
|
String |
getDefaultNsUri()
|
String |
getExplicitPrefix(String uri)
Method similar to getPrefix(java.lang.String) , but one that will not accept
the default namespace, only an explicit one. |
abstract String |
getNameDesc()
|
String |
getNamespaceURI(String prefix)
|
String |
getPrefix(String uri)
|
Iterator |
getPrefixes(String uri)
|
int |
isPrefixValid(String prefix,
String nsURI,
boolean isElement)
Method that verifies that passed-in prefix indeed maps to the specified namespace URI; and depending on how it goes returns a status for caller. |
abstract boolean |
isRoot()
|
protected void |
relink(OutputElementBase parent)
Method called to reuse a pooled instance. |
abstract void |
setDefaultNsUri(String uri)
|
protected abstract void |
setRootNsContext(NamespaceContext ctxt)
|
protected void |
throwOutputError(String msg)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PREFIX_UNBOUND
public static final int PREFIX_OK
public static final int PREFIX_MISBOUND
protected NamespaceContext mRootNsContext
protected String mDefaultNsURI
protected BijectiveNsMap mNsMapping
protected boolean mNsMapShared
mNsMapping
is a shared copy from the parent;
false if a local copy was created (which happens when namespaces
get bound etc).
Constructor Detail |
---|
protected OutputElementBase()
protected OutputElementBase(OutputElementBase parent, BijectiveNsMap ns)
Method Detail |
---|
protected void relink(OutputElementBase parent)
protected abstract void setRootNsContext(NamespaceContext ctxt)
public abstract boolean isRoot()
public abstract String getNameDesc()
public final String getDefaultNsUri()
public final String getExplicitPrefix(String uri)
getPrefix(java.lang.String)
, but one that will not accept
the default namespace, only an explicit one. Usually used when
trying to find a prefix for attributes.
public final int isPrefixValid(String prefix, String nsURI, boolean isElement) throws XMLStreamException
isElement
- If true, rules for the default NS are those of elements
(ie. empty prefix can map to non-default namespace); if false,
rules are those of attributes (only non-default prefix can map to
a non-default namespace).
XMLStreamException
- True if default (no) prefix is allowed to
match a non-default URI (elements); false if not (attributes)public abstract void setDefaultNsUri(String uri)
public final String generateMapping(String prefixBase, String uri, int[] seqArr)
public final void addPrefix(String prefix, String uri)
public final String getNamespaceURI(String prefix)
getNamespaceURI
in interface NamespaceContext
public final String getPrefix(String uri)
getPrefix
in interface NamespaceContext
public final Iterator getPrefixes(String uri)
getPrefixes
in interface NamespaceContext
protected final void throwOutputError(String msg) throws XMLStreamException
XMLStreamException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |