org.basex.data
Class Namespaces

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

public final class Namespaces
extends Set

This class organizes the namespaces of a database.

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

Field Summary
 
Fields inherited from class org.basex.util.Set
size
 
Constructor Summary
Namespaces()
          Default Constructor.
Namespaces(DataInput in)
          Constructor, specifying an input file.
 
Method Summary
 void add(byte[] p, byte[] u)
          Adds the specified namespace.
 void close(int p)
          Closes a node.
 void finish(DataOutput out)
          Writes the namespaces to disk.
 int get(byte[] n)
          Returns the namespace for the specified qname.
 int get(byte[] n, int p)
          Returns the namespace for the specified qname and pre value.
 int[] get(int p)
          Returns the namespace keys and values for the specified pre value.
 boolean open(int p)
          Opens a node.
 void print(PrintOutput out, int s)
          Prints the namespace structure to the specified output stream.
 
Methods inherited from class org.basex.util.Set
add, delete, id, key, keys, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Namespaces

public Namespaces()
Default Constructor.


Namespaces

public Namespaces(DataInput in)
           throws java.io.IOException
Constructor, specifying an input file.

Parameters:
in - input stream
Throws:
java.io.IOException - I/O exception
Method Detail

finish

public void finish(DataOutput out)
            throws java.io.IOException
Writes the namespaces to disk.

Parameters:
out - output stream
Throws:
java.io.IOException - I/O exception

open

public boolean open(int p)
Opens a node.

Parameters:
p - current pre value
Returns:
true if namespaces have been registered

close

public void close(int p)
Closes a node.

Parameters:
p - current pre value

add

public void add(byte[] p,
                byte[] u)
Adds the specified namespace.

Parameters:
p - namespace prefix
u - namespace uri

get

public int get(byte[] n,
               int p)
Returns the namespace for the specified qname and pre value.

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

get

public int[] get(int p)
Returns the namespace keys and values for the specified pre value.

Parameters:
p - pre value
Returns:
namespace reference or 0 if no namespace was found

get

public int get(byte[] n)
Returns the namespace for the specified qname.

Parameters:
n - tag/attribute name
Returns:
namespace

print

public void print(PrintOutput out,
                  int s)
           throws java.io.IOException
Prints the namespace structure to the specified output stream.

Parameters:
out - output stream
s - space for pre value
Throws:
java.io.IOException - I/O exception