Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.jxpath.ri
Class NamespaceResolver

    java.lang.Object
      org.apache.commons.jxpath.ri.NamespaceResolver

All Implemented Interfaces:
  Serializable, Cloneable

    public class NamespaceResolver

extends Object
implements Cloneable, Serializable

Namespace resolver for `JXPathContextReferenceImpl`.

Version:
  $Revision: 668329 $ $Date: 2008-06-16 16:59:48 -0500 (Mon, 16 Jun 2008) $
Author:
  Dmitri Plotnikov
See Also:
  Serialized Form

Field Summary
`protected HashMap` | `namespaceMap` namespace map
`protected NamespaceResolver` | `parent` Parent NamespaceResolver
`protected NodePointer` | `pointer` pointer
`protected HashMap` | `reverseMap` reverse lookup map

Constructor Summary
`NamespaceResolver()` Create a new NamespaceResolver.
`NamespaceResolver(NamespaceResolver parent)` Create a new NamespaceResolver.

Method Summary
`Object` | `clone()`
`protected String` | `getExternallyRegisteredNamespaceURI(String prefix)` 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.
`Pointer` | `getNamespaceContextPointer()` Get the namespace context pointer.
`String` | `getNamespaceURI(String prefix)` Given a prefix, returns a registered namespace URI.
`protected static String` | `getPrefix(NodePointer pointer, String namespaceURI)` Find the namespace prefix for the specified namespace URI and NodePointer.
`String` | `getPrefix(String namespaceURI)` Get the prefix associated with the specifed namespace URI.
`boolean` | `isSealed()` Learn whether this NamespaceResolver has been sealed.
`void` | `registerNamespace(String prefix, String namespaceURI)` Registers a namespace prefix.
`void` | `seal()` Seal this `NamespaceResolver`.
`void` | `setNamespaceContextPointer(NodePointer pointer)` Register a namespace for the expression context.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### parent

    protected final NamespaceResolver parent

  Parent NamespaceResolver

### namespaceMap

    protected HashMap namespaceMap

  namespace map

### reverseMap

    protected HashMap reverseMap

  reverse lookup map

### pointer

    protected NodePointer pointer

  pointer

Constructor Detail

### NamespaceResolver

    public NamespaceResolver()

  Create a new NamespaceResolver.

### NamespaceResolver

    public NamespaceResolver(NamespaceResolver parent)

  Create a new NamespaceResolver.

  Parameters:
    `parent` - NamespaceResolver

Method Detail

### getPrefix

    protected static String getPrefix(NodePointer pointer,
                                      String namespaceURI)

  Find the namespace prefix for the specified namespace URI and NodePointer.

  Parameters:
    `pointer` - location
    `namespaceURI` - to check
  Returns:
    prefix if found
  Since:
    JXPath 1.3

### registerNamespace

    public void registerNamespace(String prefix,
                                  String namespaceURI)

  Registers a namespace prefix.

  Parameters:
    `prefix` - A namespace prefix
    `namespaceURI` - A URI for that prefix

### setNamespaceContextPointer

    public void setNamespaceContextPointer(NodePointer pointer)

  Register a namespace for the expression context.

  Parameters:
    `pointer` - the Pointer to set.

### getNamespaceContextPointer

    public Pointer getNamespaceContextPointer()

  Get the namespace context pointer.

  Returns:
    Pointer

### getNamespaceURI

    public String getNamespaceURI(String prefix)

  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. See `setNamespaceContextPointer`.

  Parameters:
    `prefix` - The namespace prefix to look up
  Returns:
    namespace URI or null if the prefix is undefined.

### getExternallyRegisteredNamespaceURI

    protected String getExternallyRegisteredNamespaceURI(String prefix)

  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

    public String getPrefix(String namespaceURI)

  Get the prefix associated with the specifed namespace URI.

  Parameters:
    `namespaceURI` - the ns URI to check.
  Returns:
    String prefix

### getExternallyRegisteredPrefix

    protected String getExternallyRegisteredPrefix(String namespaceURI)

  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 this `NamespaceResolver`.

### clone

    public Object clone()

  Overrides:
    `clone` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.