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

## net.sf.saxon.om
Class NamespaceDeclarationsImpl

    java.lang.Object
      net.sf.saxon.om.NamespaceDeclarationsImpl

All Implemented Interfaces:
  NamespaceDeclarations

public class NamespaceDeclarationsImpl
extends java.lang.Object
implements NamespaceDeclarations

An implementation of the NamespaceDeclarations interface, based on encapsulating an array of namespace codes.

Constructor Summary
`NamespaceDeclarationsImpl()`
`NamespaceDeclarationsImpl(NamePool pool, int[] codes)` Construct a set of namespace declarations

Method Summary
`int` | `getLength()` Get the number of declarations (and undeclarations) in this list.
`int` | `getNamespaceCode(int index)` Get the n'th declaration in the list in the form of a namespace code.
`int[]` | `getNamespaceCodes(int[] buffer)` Get all the namespace codes, as an array.
`java.lang.String` | `getPrefix(int index)` Get the prefix of the n'th declaration (or undeclaration) in the list, counting from zero.
`java.lang.String` | `getURI(int index)` Get the namespace URI of the n'th declaration (or undeclaration) in the list, counting from zero.
`void` | `setNamePool(NamePool pool)` Set the name pool
`void` | `setNamespaceCodes(int[] codes)` Set the namespace codes.

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

Constructor Detail

### NamespaceDeclarationsImpl

    public NamespaceDeclarationsImpl()

### NamespaceDeclarationsImpl

    public NamespaceDeclarationsImpl(NamePool pool,
                                     int[] codes)

  Construct a set of namespace declarations

Parameters:
  `pool` - the name pool
  `codes` - an integer array holding the namespace codes. These codes are allocated by the name pool, and can be used to look up a prefix and uri in the name pool. If the array contains the integer -1, this acts as a terminator for the list. This is the format returned by the method `NodeInfo.getDeclaredNamespaces(int[])`. A value of null is equivalent to supplying an empty array.

Method Detail

### setNamePool

    public void setNamePool(NamePool pool)

  Set the name pool

### setNamespaceCodes

    public void setNamespaceCodes(int[] codes)

  Set the namespace codes.

  Parameters:
    `codes` - an integer array holding the namespace codes. These codes are allocated by the name pool, and can be used to look up a prefix and uri in the name pool. If the array contains the integer -1, this acts as a terminator for the list. This is the format returned by the method `NodeInfo.getDeclaredNamespaces(int[])`. A value of null is equivalent to supplying an empty array.

### getNamespaceCodes

    public int[] getNamespaceCodes(int[] buffer)

  Get all the namespace codes, as an array.

  Specified by:
    `getNamespaceCodes` in interface `NamespaceDeclarations`
  Parameters:
    `buffer` - a sacrificial array that the method is free to use to contain the result. May be null.
  Returns:
    an integer array containing namespace codes. The array may be filled completely with namespace codes, or it may be incompletely filled, in which case a -1 integer acts as a terminator.

### getLength

    public int getLength()

  Get the number of declarations (and undeclarations) in this list.

  Specified by:
    `getLength` in interface `NamespaceDeclarations`

### getPrefix

    public java.lang.String getPrefix(int index)

  Get the prefix of the n'th declaration (or undeclaration) in the list, counting from zero.

  Specified by:
    `getPrefix` in interface `NamespaceDeclarations`
  Parameters:
    `index` - the index identifying which declaration is required.
  Returns:
    the namespace prefix. For a declaration or undeclaration of the default namespace, this is the zero-length string.
  Throws:
    `java.lang.IndexOutOfBoundsException` - if the index is out of range.

### getURI

    public java.lang.String getURI(int index)

  Get the namespace URI of the n'th declaration (or undeclaration) in the list, counting from zero.

  Specified by:
    `getURI` in interface `NamespaceDeclarations`
  Parameters:
    `index` - the index identifying which declaration is required.
  Returns:
    the namespace URI. For a namespace undeclaration, this is the zero-length string.
  Throws:
    `java.lang.IndexOutOfBoundsException` - if the index is out of range.

### getNamespaceCode

    public int getNamespaceCode(int index)

  Get the n'th declaration in the list in the form of a namespace code. Namespace codes can be translated into a prefix and URI by means of methods in the NamePool

  Specified by:
    `getNamespaceCode` in interface `NamespaceDeclarations`
  Parameters:
    `index` - the index identifying which declaration is required.
  Returns:
    the namespace code. This is an integer whose upper half indicates the prefix (0 represents the default namespace), and whose lower half indicates the URI (0 represents an undeclaration).
  Throws:
    `java.lang.IndexOutOfBoundsException` - if the index is out of range.
  See Also:
    `NamePool.getPrefixFromNamespaceCode(int)`, `NamePool.getURIFromNamespaceCode(int)`

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