Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Server 8.1 API Reference

## weblogic.apache.xerces.util
Class NamespaceSupport

    java.lang.Object
      |
      +--weblogic.apache.xerces.util.NamespaceSupport

Direct Known Subclasses:
  SchemaNamespaceSupport

public class NamespaceSupport
extends java.lang.Object
implements NamespaceContext

Namespace support for XML document handlers. This class doesn't perform any error checking and assumes that all strings passed as arguments to methods are unique symbols. The SymbolTable class can be used for this purpose.

Field Summary
`protected int[]` | `fContext` Context indexes.
`protected int` | `fCurrentContext` The current context.
`protected java.lang.String[]` | `fNamespace` Namespace binding information.
`protected int` | `fNamespaceSize` The top of the namespace information array.

Constructor Summary
`NamespaceSupport()` Default constructor.
`NamespaceSupport(NamespaceContext context)` Constructs a namespace context object and initializes it with the prefixes declared in the specified context.

Method Summary
`boolean` | `declarePrefix(java.lang.String prefix, java.lang.String uri)` Declare a Namespace prefix.
`java.lang.String` | `getDeclaredPrefixAt(int index)` Returns the prefix at the specified index in the current context.
`int` | `getDeclaredPrefixCount()` Return a count of all prefixes currently declared, including the default prefix if bound.
`NamespaceContext` | `getParentContext()` Returns the parent namespace context or null if there is no parent context.
`java.lang.String` | `getPrefix(java.lang.String uri)` Look up a namespace URI and get one of the mapped prefix.
`java.lang.String` | `getURI(java.lang.String prefix)` Look up a prefix and get the currently-mapped Namespace URI.
`void` | `popContext()` Revert to the previous Namespace context.
`void` | `pushContext()` Start a new Namespace context.
`void` | `reset()` Reset this Namespace support object for reuse.

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

Field Detail

### fNamespace

    protected java.lang.String[] fNamespace

  Namespace binding information. This array is composed of a series of tuples containing the namespace binding information: <prefix, uri>. The default size can be set to anything as long as it is a power of 2 greater than 1.
  See Also:
    `fNamespaceSize`, `fContext`

### fNamespaceSize

    protected int fNamespaceSize

  The top of the namespace information array.

### fContext

    protected int[] fContext

  Context indexes. This array contains indexes into the namespace information array. The index at the current context is the start index of declared namespace bindings and runs to the size of the namespace information array.
  See Also:
    `fNamespaceSize`

### fCurrentContext

    protected int fCurrentContext

  The current context.

Constructor Detail

### NamespaceSupport

    public NamespaceSupport()

  Default constructor.

### NamespaceSupport

    public NamespaceSupport(NamespaceContext context)

  Constructs a namespace context object and initializes it with the prefixes declared in the specified context.

Method Detail

### reset

    public void reset()

  Reset this Namespace support object for reuse.

  It is necessary to invoke this method before reusing the Namespace support object for a new session.

### pushContext

    public void pushContext()

  Start a new Namespace context.

  Normally, you should push a new context 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.

  The Namespace support object always starts with a base context already in force: in this context, only the "xml" prefix is declared.

  See Also:
    `popContext()`

### popContext

    public void popContext()

  Revert to the previous Namespace context.

  Normally, you should pop the context at the end of each XML element. After popping the context, all Namespace prefix mappings that were previously in force are restored.

  You must not attempt to declare additional Namespace prefixes after popping a context, unless you push another context first.

  See Also:
    `pushContext()`

### declarePrefix

    public boolean declarePrefix(java.lang.String prefix,
                                 java.lang.String uri)

  Declare 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.

  To declare a default Namespace, use the empty string. The prefix must not be "xml" or "xmlns".

  Note that you must not declare a prefix after you've pushed and popped another Namespace.

  Parameters:
    `prefix` - The prefix to declare, or null for the empty string.
    `uri` - The Namespace URI to associate with the prefix.
  Returns:
    true if the prefix was legal, false otherwise
  See Also:
    `getURI(java.lang.String)`, `getDeclaredPrefixAt(int)`

### getURI

    public java.lang.String getURI(java.lang.String prefix)

  Look up a prefix and get the currently-mapped Namespace URI.

  This method looks up the prefix in the current context. Use the empty string ("") for the default Namespace.

  Specified by:
    getURI in interface NamespaceContext

  Parameters:
    `prefix` - The prefix to look up.
  Returns:
    The associated Namespace URI, or null if the prefix is undeclared in this context.
  See Also:
    `getDeclaredPrefixAt(int)`

### getPrefix

    public java.lang.String getPrefix(java.lang.String uri)

  Look up a namespace URI and get one of the mapped prefix.

  This method looks up the namespace URI in the current context.

  Parameters:
    `uri` - The namespace URI to look up.
  Returns:
    one of the associated prefixes, or null if the uri does not map to any prefix.
  See Also:
    `getPrefix(java.lang.String)`

### getDeclaredPrefixCount

    public int getDeclaredPrefixCount()

  Return a count of all prefixes currently declared, including the default prefix if bound.
  Specified by:
    getDeclaredPrefixCount in interface NamespaceContext

### getDeclaredPrefixAt

    public java.lang.String getDeclaredPrefixAt(int index)

  Returns the prefix at the specified index in the current context.
  Specified by:
    getDeclaredPrefixAt in interface NamespaceContext

### getParentContext

    public NamespaceContext getParentContext()

  Returns the parent namespace context or null if there is no parent context. The total depth of the namespace contexts matches the element depth in the document.

  Note: This method may return the same NamespaceContext object reference. The caller is responsible for saving the declared prefix mappings before calling this method.

  Specified by:
    getParentContext in interface NamespaceContext

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs81
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD