## org.exist.dom
Class SymbolTable

    java.lang.Object
      org.exist.dom.SymbolTable

public class SymbolTable
extends java.lang.Object

Maintains a global symbol table shared by a database instance. The symbol table maps namespace URIs and node names to unique, numeric ids. Internally, the db does not store node QNames in clear text. Instead, it uses the numeric ids maintained here. The global SymbolTable singleton can be retrieved from `DBBroker.getSymbols()`. It is saved into the database file "symbols.dbx".

Author:
  wolf

Constructor Summary
`SymbolTable(java.io.File file)`

Method Summary
`java.lang.String[]` `defaultPrefixList()` Returns a list of default prefixes registered.
`java.lang.String` `getDefaultNamespace(java.lang.String prefix)` Returns a namespace URI for the given prefix if there's a default mapping.
`java.io.File` `getFile()`
`java.lang.String` `getName(short id)` Returns the local name registered for the id or null if the name is not known.
`java.lang.String` `getNamespace(short id)` Returns the namespace URI registered for the id or null if the namespace URI is not known.
`short` `getNSSymbol(java.lang.String ns)` Returns a unique id for the specified namespace URI.
`QName` `getQName(short type, java.lang.String namespaceURI, java.lang.String localName, java.lang.String prefix)` Retrieve a shared QName instance from the temporary pool.
`short` `getSymbol(org.w3c.dom.Attr attr)` Return a unique id for the local node name of the specified attribute.
`short` `getSymbol(org.w3c.dom.Element element)` Return a unique id for the local node name of the specified element.
`short` `getSymbol(java.lang.String name)` Returns a unique id for the specified local name.
`boolean` `hasChanged()` Returns true if the symbol table needs to be saved to persistent storage.
`void` `read(VariableByteInput istream)` Read the symbol table.
`void` `write(VariableByteOutputStream ostream)` Write the symbol table to persistent storage.

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

Constructor Detail

### SymbolTable

    public SymbolTable(java.io.File file)

Method Detail

### getQName

    public QName getQName(short type,
                          java.lang.String namespaceURI,
                          java.lang.String localName,
                          java.lang.String prefix)

  Retrieve a shared QName instance from the temporary pool.

  Parameters:
    `namespaceURI` -
    `localName` -
    `prefix` -

### getSymbol

    public short getSymbol(org.w3c.dom.Element element)

  Return a unique id for the local node name of the specified element.

  Parameters:
    `element` -

### getSymbol

    public short getSymbol(org.w3c.dom.Attr attr)

  Return a unique id for the local node name of the specified attribute.

  Parameters:
    `attr` -

### getSymbol

    public short getSymbol(java.lang.String name)

  Returns a unique id for the specified local name. If the name is the local name of an attribute, it should start with a '@' character.

  Parameters:
    `name` -

### getNSSymbol

    public short getNSSymbol(java.lang.String ns)

  Returns a unique id for the specified namespace URI.

  Parameters:
    `ns` -

### getNamespace

    public java.lang.String getNamespace(short id)

  Returns the namespace URI registered for the id or null if the namespace URI is not known. Returns the empty string if the namespace is empty.

  Parameters:
    `id` -

### hasChanged

    public boolean hasChanged()

  Returns true if the symbol table needs to be saved to persistent storage.

### getName

    public java.lang.String getName(short id)

  Returns the local name registered for the id or null if the name is not known.

  Parameters:
    `id` -

### getDefaultNamespace

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

  Returns a namespace URI for the given prefix if there's a default mapping.

  Parameters:
    `prefix` -

### defaultPrefixList

    public java.lang.String[] defaultPrefixList()

  Returns a list of default prefixes registered.

### write

    public void write(VariableByteOutputStream ostream)
               throws java.io.IOException

  Write the symbol table to persistent storage.

  Parameters:
    `ostream` -
  Throws:
    `java.io.IOException`

### read

    public void read(VariableByteInput istream)
              throws java.io.IOException

  Read the symbol table.

  Parameters:
    `istream` -
  Throws:
    `java.io.IOException`

### getFile

    public java.io.File getFile()

Copyright (C) Wolfgang Meier. All rights reserved.