This class is also used to keep track of tag names for each element for the marshaller (for the performance reason.)
| Modifier and Type | Class and Description |
|---|---|
| public class | NamespaceContextImpl.
This model of namespace declarations maintain the following invariants. |
| Modifier and Type | Field and Description |
|---|---|
| public boolean | collectionMode
True to allow new URIs to be declared. |
| private NamespaceContextImpl. | |
| private static final NamespacePrefixMapper | defaultNamespacePrefixMapper
Default |
| private String[] | |
| private final XMLSerializer | |
| private String[] | |
| private NamespacePrefixMapper | prefixMapper
Never null. |
| private int | size
Number of URIs declared. |
| private final NamespaceContextImpl. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public String | declareNamespace(String namespaceUri, String preferedPrefix, boolean requirePrefix)
Implements org. Declares a new namespace binding within the current context. |
| public int | declareNsUri(String uri, String preferedPrefix, boolean requirePrefix)
Returns the prefix index to the specified URI. |
| public int | force(String uri, String prefix)
Implements org. Forcibly make a namespace declaration in effect. |
| public NamespaceContextImpl. | |
| public String | |
| public String | Returns: null if the prefix is unbound.Implements javax. Gets the namespace URI that is bound to the specified prefix. |
| public String | |
| public String | getPrefix(String uri)
Implements javax. Returns the prefix of the specified URI, or null if none exists. |
| public Iterator | getPrefixes(String uri)
Implements javax. Get all prefixes bound to a Namespace URI in the current scope. |
| public int | |
| public NamespacePrefixMapper | |
| private String | |
| public int | |
| public void | |
| public void |
| collectionMode | back to summary |
|---|---|
| public boolean collectionMode True to allow new URIs to be declared. False otherwise. | |
| current | back to summary |
|---|---|
| private NamespaceContextImpl. | |
| defaultNamespacePrefixMapper | back to summary |
|---|---|
| private static final NamespacePrefixMapper defaultNamespacePrefixMapper Default | |
| nsUris | back to summary |
|---|---|
| private String[] nsUris | |
| owner | back to summary |
|---|---|
| private final XMLSerializer owner | |
| prefixes | back to summary |
|---|---|
| private String[] prefixes | |
| prefixMapper | back to summary |
|---|---|
| private NamespacePrefixMapper prefixMapper Never null. | |
| size | back to summary |
|---|---|
| private int size Number of URIs declared. Identifies the valid portion of
the | |
| top | back to summary |
|---|---|
| private final NamespaceContextImpl. This is the | |
| NamespaceContextImpl | back to summary |
|---|---|
| public NamespaceContextImpl(XMLSerializer owner) | |
| count | back to summary |
|---|---|
| public int count() Number of total bindings declared. | |
| declareNamespace | back to summary |
|---|---|
| public String declareNamespace(String namespaceUri, String preferedPrefix, boolean requirePrefix) Implements org. Doc from org. Declares a new namespace binding within the current context. The prefix is automatically assigned by MarshallingContext. If a given namespace URI is already declared, nothing happens. It is NOT an error to declare the same namespace URI more than once. For marshalling to work correctly, all namespace bindings for an element must be declared between its startElement method and its endAttributes event. Calling the same method with the same parameter between the endAttributes and the endElement returns the same prefix.
| |
| declareNsUri | back to summary |
|---|---|
| public int declareNsUri(String uri, String preferedPrefix, boolean requirePrefix) Returns the prefix index to the specified URI. This method allocates a new URI if necessary. | |
| force | back to summary |
|---|---|
| public int force(String uri, String prefix) Implements org. Doc from org. Forcibly make a namespace declaration in effect. If the (prefix,uri) binding is already in-scope, this method simply returns the assigned prefix index. Otherwise a new declaration will be put.
| |
| getCurrent | back to summary |
|---|---|
| public NamespaceContextImpl. | |
| getNamespaceURI | back to summary |
|---|---|
| public String getNamespaceURI(int prefixIndex) | |
| getNamespaceURI | back to summary |
|---|---|
| public String getNamespaceURI(String prefix) Implements javax. Gets the namespace URI that is bound to the specified prefix. | |
| getPrefix | back to summary |
|---|---|
| public String getPrefix(int prefixIndex) Gets the prefix from a prefix index. The behavior is undefined if the index is out of range. | |
| getPrefix | back to summary |
|---|---|
| public String getPrefix(String uri) Implements javax. Returns the prefix of the specified URI, or null if none exists.
| |
| getPrefixes | back to summary | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public Iterator Implements javax. Doc from javax. Get all prefixes bound to a Namespace URI in the current scope. An Iterator over String elements is returned in an arbitrary, implementation dependent, order. The When requesting prefixes by Namespace URI, the following table describes the returned prefixes value for all Namespace URI values:
| |||||||||||||
| getPrefixIndex | back to summary |
|---|---|
| public int getPrefixIndex(String uri) Returns the prefix index of the specified URI. It is an error if the URI is not declared. | |
| getPrefixMapper | back to summary |
|---|---|
| public NamespacePrefixMapper getPrefixMapper() | |
| makeUniquePrefix | back to summary |
|---|---|
| private String makeUniquePrefix() | |
| put | back to summary |
|---|---|
| public int put(String uri, String prefix) Puts this new binding into the declared prefixes list without doing any duplicate check. This can be used to forcibly set namespace declarations.
Most of the time
| |
| reset | back to summary |
|---|---|
| public void reset() | |
| setPrefixMapper | back to summary |
|---|---|
| public void setPrefixMapper(NamespacePrefixMapper mapper) | |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| public final NamespaceContextImpl | |
| private int | |
| private final int | |
| private String | |
| private Name | elementName
Tag name of this element. |
| private int | |
| private Object | |
| private NamespaceContextImpl. | |
| private int | |
| private Object | outerPeer
Used for the binder. |
| private final NamespaceContextImpl. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public void | |
| public int | |
| public Object | |
| public String | |
| public Object | |
| public NamespaceContextImpl. | |
| public String | |
| public boolean | |
| private void | |
| public NamespaceContextImpl. | |
| public NamespaceContextImpl. | |
| public void | |
| public void | |
| public void |
| baseIndex | back to summary |
|---|---|
| private int baseIndex The numbe of prefixes declared by ancestor | |
| context | back to summary |
|---|---|
| public final NamespaceContextImpl context | |
| defaultPrefixIndex | back to summary |
|---|---|
| private int defaultPrefixIndex | |
| depth | back to summary |
|---|---|
| private final int depth The depth of the
int depth() {
int i=-1;
for(Element e=this; e!=null;e=e.prev)
i++;
return i;
}
| |
| elementLocalName | back to summary |
|---|---|
| private String elementLocalName | |
| elementName | back to summary |
|---|---|
| private Name elementName Tag name of this element.
Either this field is used or the | |
| elementNamePrefix | back to summary |
|---|---|
| private int elementNamePrefix | |
| innerPeer | back to summary |
|---|---|
| private Object innerPeer | |
| next | back to summary |
|---|---|
| private NamespaceContextImpl. | |
| oldDefaultNamespaceUriIndex | back to summary |
|---|---|
| private int oldDefaultNamespaceUriIndex | |
| outerPeer | back to summary |
|---|---|
| private Object outerPeer Used for the binder. The JAXB object that corresponds to this element. | |
| prev | back to summary |
|---|---|
| private final NamespaceContextImpl.
| |
| Element | back to summary |
|---|---|
| private Element(NamespaceContextImpl context, NamespaceContextImpl. | |
| count | back to summary |
|---|---|
| public int count() Gets the number of bindings declared on this element. | |
| endElement | back to summary |
|---|---|
| public void endElement(XmlOutput out) throws IOException, SAXException, XMLStreamException | |
| getBase | back to summary |
|---|---|
| public int getBase() | |
| getInnerPeer | back to summary |
|---|---|
| public Object getInnerPeer() | |
| getNsUri | back to summary |
|---|---|
| public String getNsUri(int idx) Gets the namespace URI declared in this context.
| |
| getOuterPeer | back to summary |
|---|---|
| public Object getOuterPeer() | |
| getParent | back to summary |
|---|---|
| public NamespaceContextImpl. Gets the parent . | |
| getPrefix | back to summary |
|---|---|
| public String getPrefix(int idx) Gets the prefix declared in this context.
| |
| isRootElement | back to summary |
|---|---|
| public boolean isRootElement() Returns true if this represents the root element that we are marshalling. | |
| onPushed | back to summary |
|---|---|
| private void onPushed() | |
| pop | back to summary |
|---|---|
| public NamespaceContextImpl. | |
| push | back to summary |
|---|---|
| public NamespaceContextImpl. | |
| setTagName | back to summary |
|---|---|
| public void setTagName(int prefix, String localName, Object outerPeer) | |
| setTagName | back to summary |
|---|---|
| public void setTagName(Name tagName, Object outerPeer) | |
| startElement | back to summary |
|---|---|
| public void startElement(XmlOutput out, Object innerPeer) throws IOException, XMLStreamException | |