org.basex.data
Class Namespaces

java.lang.Object
  extended by org.basex.data.Namespaces

public final class Namespaces
extends Object

This class contains the namespaces of a database.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen

Constructor Summary
Namespaces()
          Empty constructor.
 
Method Summary
 void add(byte[] p, byte[] u, int pre)
          Adds the specified namespace to the namespace structure and changes the root node.
 int add(int pre, int par, byte[] p, byte[] u)
          Adds a namespace for the specified pre value.
 int addURI(byte[] u)
          Adds the specified namespace uri.
 void close(int pre)
          Closes a node.
 byte[] info()
          Returns namespace information.
 boolean open()
          Opens an element.
 int size()
          Returns the number of uri references.
 byte[] table(int s, int e)
          Returns a tabular representation of the namespaces.
 String toString()
           
 String toString(int s, int e)
          Returns a string representation of the namespaces.
 int uri(byte[] n, boolean elem)
          Returns the namespace uri reference for the specified name, or 0 if namespace cannot be found.
 int uri(byte[] name, int pre)
          Returns the namespace URI reference for the specified QName and pre value.
 byte[] uri(int id)
          Returns the specified namespace uri.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Namespaces

public Namespaces()
Empty constructor.

Method Detail

add

public void add(byte[] p,
                byte[] u,
                int pre)
Adds the specified namespace to the namespace structure and changes the root node.

Parameters:
p - prefix
u - uri
pre - pre value

open

public boolean open()
Opens an element.

Returns:
true if a new namespace has been added

close

public void close(int pre)
Closes a node.

Parameters:
pre - current pre value

uri

public int uri(byte[] n,
               boolean elem)
Returns the namespace uri reference for the specified name, or 0 if namespace cannot be found.

Parameters:
n - tag/attribute name
elem - element flag
Returns:
namespace

size

public int size()
Returns the number of uri references.

Returns:
number of uri references

uri

public byte[] uri(int id)
Returns the specified namespace uri.

Parameters:
id - namespace uri reference
Returns:
prefix

uri

public int uri(byte[] name,
               int pre)
Returns the namespace URI reference for the specified QName and pre value.

Parameters:
name - tag/attribute name
pre - pre value
Returns:
namespace URI reference or 0 if no namespace was found

add

public int add(int pre,
               int par,
               byte[] p,
               byte[] u)
Adds a namespace for the specified pre value.

Parameters:
pre - pre value
par - parent
p - prefix
u - uri
Returns:
uri reference

addURI

public int addURI(byte[] u)
Adds the specified namespace uri.

Parameters:
u - namespace uri to be added
Returns:
reference

table

public byte[] table(int s,
                    int e)
Returns a tabular representation of the namespaces.

Parameters:
s - start pre value
e - end pre value
Returns:
namespaces

info

public byte[] info()
Returns namespace information.

Returns:
info string

toString

public String toString(int s,
                       int e)
Returns a string representation of the namespaces.

Parameters:
s - start pre value
e - end pre value
Returns:
string

toString

public String toString()
Overrides:
toString in class Object