Package org.apache.commons.jxpath.ri
Class NamespaceResolver
java.lang.Object
org.apache.commons.jxpath.ri.NamespaceResolver
- All Implemented Interfaces:
Serializable
,Cloneable
Namespace resolver for
JXPathContextReferenceImpl
.- Version:
- $Revision: 668329 $ $Date: 2008-06-16 16:59:48 -0500 (Mon, 16 Jun 2008) $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HashMap
namespace mapprotected final NamespaceResolver
Parent NamespaceResolverprotected NodePointer
pointerprotected HashMap
reverse lookup mapprivate boolean
private static final long
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new NamespaceResolver.NamespaceResolver
(NamespaceResolver parent) Create a new NamespaceResolver. -
Method Summary
Modifier and TypeMethodDescriptionclone()
protected String
Given a prefix, returns an externally registered namespace URI.protected String
getExternallyRegisteredPrefix
(String namespaceURI) Get the nearest prefix found that matches an externally-registered namespace.Get the namespace context pointer.getNamespaceURI
(String prefix) Given a prefix, returns a registered namespace URI.Get the prefix associated with the specifed namespace URI.protected static String
getPrefix
(NodePointer pointer, String namespaceURI) Find the namespace prefix for the specified namespace URI and NodePointer.boolean
isSealed()
Learn whether this NamespaceResolver has been sealed.void
registerNamespace
(String prefix, String namespaceURI) Registers a namespace prefix.void
seal()
Seal thisNamespaceResolver
.void
setNamespaceContextPointer
(NodePointer pointer) Register a namespace for the expression context.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
parent
Parent NamespaceResolver -
namespaceMap
namespace map -
reverseMap
reverse lookup map -
pointer
pointer -
sealed
private boolean sealed
-
-
Constructor Details
-
NamespaceResolver
public NamespaceResolver()Create a new NamespaceResolver. -
NamespaceResolver
Create a new NamespaceResolver.- Parameters:
parent
- NamespaceResolver
-
-
Method Details
-
getPrefix
Find the namespace prefix for the specified namespace URI and NodePointer.- Parameters:
pointer
- locationnamespaceURI
- to check- Returns:
- prefix if found
- Since:
- JXPath 1.3
-
registerNamespace
Registers a namespace prefix.- Parameters:
prefix
- A namespace prefixnamespaceURI
- A URI for that prefix
-
setNamespaceContextPointer
Register a namespace for the expression context.- Parameters:
pointer
- the Pointer to set.
-
getNamespaceContextPointer
Get the namespace context pointer.- Returns:
- Pointer
-
getNamespaceURI
Given a prefix, returns a registered namespace URI. If the requested prefix was not defined explicitly using the registerNamespace method, JXPathContext will then check the context node to see if the prefix is defined there. SeesetNamespaceContextPointer
.- Parameters:
prefix
- The namespace prefix to look up- Returns:
- namespace URI or null if the prefix is undefined.
-
getExternallyRegisteredNamespaceURI
Given a prefix, returns an externally registered namespace URI.- Parameters:
prefix
- The namespace prefix to look up- Returns:
- namespace URI or null if the prefix is undefined.
- Since:
- JXPath 1.3
-
getPrefix
Get the prefix associated with the specifed namespace URI.- Parameters:
namespaceURI
- the ns URI to check.- Returns:
- String prefix
-
getExternallyRegisteredPrefix
Get the nearest prefix found that matches an externally-registered namespace.- Parameters:
namespaceURI
- the ns URI to check.- Returns:
- String prefix if found.
- Since:
- JXPath 1.3
-
isSealed
public boolean isSealed()Learn whether this NamespaceResolver has been sealed.- Returns:
- boolean
-
seal
public void seal()Seal thisNamespaceResolver
. -
clone
-