NamespaceStack (dom4j 1.6.1 API)

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.dom4j.tree
Class NamespaceStack

    java.lang.Object
      org.dom4j.tree.NamespaceStack

public class NamespaceStack
extends Object

NamespaceStack implements a stack of namespaces and optionally maintains a cache of all the fully qualified names (`QName`) which are in scope. This is useful when building or navigating a dom4j document.

Version:
  $Revision: 1.13 $
Author:
  James Strachan

Constructor Summary
`NamespaceStack()`
`NamespaceStack(DocumentFactory documentFactory)`

Method Summary
`Namespace` | `addNamespace(String prefix, String uri)` Adds a new namespace to the stack
`void` | `clear()` Clears the stack
`boolean` | `contains(Namespace namespace)` DOCUMENT ME!
`protected Namespace` | `createNamespace(String prefix, String namespaceURI)` Factory method to creeate new Namespace instances.
`protected QName` | `createQName(String localName, String qualifiedName, Namespace namespace)` Factory method to creeate new QName instances.
`protected Namespace` | `findDefaultNamespace()` Attempts to find the current default namespace on the stack right now or returns null if one could not be found
`QName` | `getAttributeQName(String namespaceURI, String localName, String qualifiedName)`
`Namespace` | `getDefaultNamespace()`
`DocumentFactory` | `getDocumentFactory()`
`Namespace` | `getNamespace(int index)` DOCUMENT ME!
`protected Map` | `getNamespaceCache()`
`Namespace` | `getNamespaceForPrefix(String prefix)` DOCUMENT ME!
`QName` | `getQName(String namespaceURI, String localName, String qualifiedName)`
`String` | `getURI(String prefix)` DOCUMENT ME!
`Namespace` | `pop()` Pops the most recently used `Namespace` from the stack
`Namespace` | `pop(String prefix)` Pops a namepace from the stack with the given prefix and URI
`void` | `push(Namespace namespace)` Pushes the given namespace onto the stack so that its prefix becomes available.
`void` | `push(String prefix, String uri)` Adds a namepace to the stack with the given prefix and URI
`protected QName` | `pushQName(String localName, String qualifiedName, Namespace namespace, String prefix)` Adds the QName to the stack of available QNames
`protected Namespace` | `remove(int index)` Removes the namespace at the given index of the stack
`void` | `setDocumentFactory(DocumentFactory documentFactory)`
`int` | `size()` DOCUMENT ME!
`String` | `toString()`

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

Constructor Detail

### NamespaceStack

    public NamespaceStack()

### NamespaceStack

    public NamespaceStack(DocumentFactory documentFactory)

Method Detail

### push

    public void push(Namespace namespace)

  Pushes the given namespace onto the stack so that its prefix becomes available.

  Parameters:
    `namespace` - is the `Namespace` to add to the stack.

### pop

    public Namespace pop()

  Pops the most recently used `Namespace` from the stack

  Returns:
    Namespace popped from the stack

### size

    public int size()

  DOCUMENT ME!

  Returns:
    the number of namespaces on the stackce stack.

### clear

    public void clear()

  Clears the stack

### getNamespace

    public Namespace getNamespace(int index)

  DOCUMENT ME!

  Parameters:
    `index` - DOCUMENT ME!
  Returns:
    the namespace at the specified index on the stack

### getNamespaceForPrefix

    public Namespace getNamespaceForPrefix(String prefix)

  DOCUMENT ME!

  Parameters:
    `prefix` - DOCUMENT ME!
  Returns:
    the namespace for the given prefix or null if it could not be found.

### getURI

    public String getURI(String prefix)

  DOCUMENT ME!

  Parameters:
    `prefix` - DOCUMENT ME!
  Returns:
    the URI for the given prefix or null if it could not be found.

### contains

    public boolean contains(Namespace namespace)

  DOCUMENT ME!

  Parameters:
    `namespace` - DOCUMENT ME!
  Returns:
    true if the given prefix is in the stack.

### getQName

    public QName getQName(String namespaceURI,
                          String localName,
                          String qualifiedName)

### getAttributeQName

    public QName getAttributeQName(String namespaceURI,
                                   String localName,
                                   String qualifiedName)

### push

    public void push(String prefix,
                     String uri)

  Adds a namepace to the stack with the given prefix and URI

  Parameters:
    `prefix` - DOCUMENT ME!
    `uri` - DOCUMENT ME!

### addNamespace

    public Namespace addNamespace(String prefix,
                                  String uri)

  Adds a new namespace to the stack

  Parameters:
    `prefix` - DOCUMENT ME!
    `uri` - DOCUMENT ME!
  Returns:
    DOCUMENT ME!

### pop

    public Namespace pop(String prefix)

  Pops a namepace from the stack with the given prefix and URI

  Parameters:
    `prefix` - DOCUMENT ME!
  Returns:
    DOCUMENT ME!

### toString

    public String toString()

### getDocumentFactory

    public DocumentFactory getDocumentFactory()

### setDocumentFactory

    public void setDocumentFactory(DocumentFactory documentFactory)

### getDefaultNamespace

    public Namespace getDefaultNamespace()

### pushQName

    protected QName pushQName(String localName,
                              String qualifiedName,
                              Namespace namespace,
                              String prefix)

  Adds the QName to the stack of available QNames

  Parameters:
    `localName` - DOCUMENT ME!
    `qualifiedName` - DOCUMENT ME!
    `namespace` - DOCUMENT ME!
    `prefix` - DOCUMENT ME!
  Returns:
    DOCUMENT ME!

### createQName

    protected QName createQName(String localName,
                                String qualifiedName,
                                Namespace namespace)

  Factory method to creeate new QName instances. By default this method interns the QName

  Parameters:
    `localName` - DOCUMENT ME!
    `qualifiedName` - DOCUMENT ME!
    `namespace` - DOCUMENT ME!
  Returns:
    DOCUMENT ME!

### createNamespace

    protected Namespace createNamespace(String prefix,
                                        String namespaceURI)

  Factory method to creeate new Namespace instances. By default this method interns the Namespace

  Parameters:
    `prefix` - DOCUMENT ME!
    `namespaceURI` - DOCUMENT ME!
  Returns:
    DOCUMENT ME!

### findDefaultNamespace

    protected Namespace findDefaultNamespace()

  Attempts to find the current default namespace on the stack right now or returns null if one could not be found

  Returns:
    DOCUMENT ME!

### remove

    protected Namespace remove(int index)

  Removes the namespace at the given index of the stack

  Parameters:
    `index` - DOCUMENT ME!
  Returns:
    DOCUMENT ME!

### getNamespaceCache

    protected Map getNamespaceCache()

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-2005 MetaStuff Ltd.. All Rights Reserved.