Package groovy.xml
Class XmlNodePrinter.NamespaceContext
java.lang.Object
groovy.xml.XmlNodePrinter.NamespaceContext
- Enclosing class:
- XmlNodePrinter
Tracks namespace declarations already emitted while printing a subtree.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty namespace context.Creates a namespace context initialized from an existing context. -
Method Summary
Modifier and TypeMethodDescriptiongetNamespace(String prefix) Returns the namespace URI currently registered for the supplied prefix.booleanisPrefixRegistered(String prefix, String uri) Checks whether a prefix is already registered for the supplied namespace URI.voidregisterNamespacePrefix(String prefix, String uri) Records a namespace prefix mapping if it has not already been registered.
-
Constructor Details
-
NamespaceContext
public NamespaceContext()Creates an empty namespace context. -
NamespaceContext
Creates a namespace context initialized from an existing context.- Parameters:
context- the context to copy
-
-
Method Details
-
isPrefixRegistered
Checks whether a prefix is already registered for the supplied namespace URI.- Parameters:
prefix- the namespace prefix to look upuri- the namespace URI to compare against- Returns:
trueif the prefix is already registered for that URI
-
registerNamespacePrefix
Records a namespace prefix mapping if it has not already been registered.- Parameters:
prefix- the namespace prefix to registeruri- the namespace URI to associate withprefix
-
getNamespace
Returns the namespace URI currently registered for the supplied prefix.- Parameters:
prefix- the namespace prefix to resolve- Returns:
- the registered namespace URI, or
nullif none is registered
-