public class NamespaceContextImpl extends Object implements NamespaceContext2
Constructor and Description |
---|
NamespaceContextImpl(com.sun.xml.bind.marshaller.NamespacePrefixMapper _prefixMapper) |
Modifier and Type | Method and Description |
---|---|
String |
declareNamespace(String namespaceUri,
String preferedPrefix,
boolean requirePrefix)
Declares a new namespace binding within the current context.
|
void |
endElement()
Ends the current element context and gets back to the parent context.
|
void |
endNamespaceDecls()
Reconciles the namespace URI/prefix mapping requests since the
last startElement method invocation and finalizes them.
|
com.sun.xml.bind.marshaller.NamespacePrefixMapper |
getNamespacePrefixMapper() |
String |
getNamespaceURI(String prefix)
Obtains the namespace URI currently associated to the given prefix.
|
String |
getPrefix(String namespaceUri) |
Iterator |
getPrefixes(String namespaceUri) |
void |
iterateDeclaredPrefixes(PrefixCallback callback)
Iterates all newly declared namespace prefixes for this element.
|
void |
startElement()
Sets the current bindings aside and starts a new element context.
|
public NamespaceContextImpl(com.sun.xml.bind.marshaller.NamespacePrefixMapper _prefixMapper)
public final com.sun.xml.bind.marshaller.NamespacePrefixMapper getNamespacePrefixMapper()
public String declareNamespace(String namespaceUri, String preferedPrefix, boolean requirePrefix)
NamespaceContext2
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.
declareNamespace
in interface NamespaceContext2
requirePrefix
- true if this is called for attribute name. false otherwise.preferedPrefix
- If the caller has any particular preference to the
prefix, pass that as a parameter. The callee will try
to honor it. Set null if there's no particular preference.public String getPrefix(String namespaceUri)
getPrefix
in interface NamespaceContext
public String getNamespaceURI(String prefix)
getNamespaceURI
in interface NamespaceContext
public Iterator getPrefixes(String namespaceUri)
getPrefixes
in interface NamespaceContext
public void startElement()
public void endNamespaceDecls()
public void endElement()
public void iterateDeclaredPrefixes(PrefixCallback callback) throws SAXException
SAXException
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.