- All Implemented Interfaces:
NamespaceContext
- Author:
- Andy Clark, IBM, Ronald Brill
-
Field Summary
Fields inherited from interface org.htmlunit.cyberneko.xerces.xni.NamespaceContext
XML_URI, XMLNS_URI -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandeclarePrefix(String prefix, String uri) Declares a Namespace prefix.getDeclaredPrefixAt(int index) Returns the prefix at the specified index in the current context.intReturns a count of locally declared prefixes, including the default prefix if bound.Looks up a prefix and gets the currently-mapped Namespace URI.voidReverts to the previous Namespace context.voidStarts a new Namespace context.voidreset()Resets this Namespace support object for reuse.
-
Constructor Details
-
NamespaceSupport
public NamespaceSupport()Constructs a defaultNamespaceSupportinstance.
-
-
Method Details
-
reset
public void reset()Resets this Namespace support object for reuse.It is necessary to invoke this method before reusing the Namespace support object for a new session.
Note that implementations of this method need to ensure that the declarations of the prefixes "xmlns" and "xml" remain available.
- Specified by:
resetin interfaceNamespaceContext- See Also:
-
pushContext
public void pushContext()Starts a new Namespace context.A new context should be pushed at the beginning of each XML element: the new context will automatically inherit the declarations of its parent context, but it will also keep track of which declarations were made within this context.
- Specified by:
pushContextin interfaceNamespaceContext- See Also:
-
popContext
public void popContext()Reverts to the previous Namespace context.The context should be popped at the end of each XML element. After popping the context, all Namespace prefix mappings that were previously in force are restored.
Users must not attempt to declare additional Namespace prefixes after popping a context unless another context is pushed first.
- Specified by:
popContextin interfaceNamespaceContext- See Also:
-
declarePrefix
Declares a Namespace prefix.This method declares a prefix in the current Namespace context; the prefix will remain in force until this context is popped, unless it is shadowed in a descendant context.
Note that to declare a default Namespace, use the empty string. The prefixes "xml" and "xmlns" cannot be rebound.
- Specified by:
declarePrefixin interfaceNamespaceContext- Parameters:
prefix- the prefix to declare, ornullor empty string for the default namespaceuri- the Namespace URI to associate with the prefix- Returns:
trueif the prefix was legal,falseotherwise- See Also:
-
getURI
Looks up a prefix and gets the currently-mapped Namespace URI.This method looks up the prefix in the current context. If no mapping is found, this method will continue lookup in the parent context(s). Use the empty string (
"") for the default Namespace.- Specified by:
getURIin interfaceNamespaceContext- Parameters:
prefix- the prefix to look up- Returns:
- the associated Namespace URI, or
nullif the prefix is undeclared - See Also:
-
getDeclaredPrefixCount
public int getDeclaredPrefixCount()Returns a count of locally declared prefixes, including the default prefix if bound.- Specified by:
getDeclaredPrefixCountin interfaceNamespaceContext- Returns:
- the count of locally declared prefixes
- See Also:
-
getDeclaredPrefixAt
Returns the prefix at the specified index in the current context.- Specified by:
getDeclaredPrefixAtin interfaceNamespaceContext- Parameters:
index- the zero-based index position of the declared prefix- Returns:
- the prefix at the specified index, or
nullif out of bounds - See Also:
-