Class Namespaces

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

public final class Namespaces extends Object
This class organizes the namespaces of a database.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Summary

    Constructors
    Constructor
    Description
    Empty constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    add(int pre, byte[] prefix, byte[] uri, Data data)
    Adds a single namespace for the specified pre value.
    void
    close(int pre)
    Closes a namespace node.
    void
    delete(byte[] uri)
    Deletes the specified namespace URI from the root node.
    byte[]
    Returns namespace information.
    boolean
    Returns if no namespaces exist.
    void
    Increases the level counter and sets a new default namespace.
    void
    open(int pre, Atts atts)
    Adds namespaces to a new namespace child node and sets this node as new cursor.
    int
    Returns the number of namespaces that have been stored so far.
     
    byte[]
    uri(int id)
    Returns a namespace URI for the name with the specified id.
    int
    uriId(byte[] uri)
    Returns the id of the specified namespace uri.
    int
    uriIdForPrefix(byte[] prefix, boolean element)
    Returns the id of a namespace URI for the specified prefix.
    int
    uriIdForPrefix(byte[] prefix, int pre, Data data)
    Returns the id of a namespace URI for the specified prefix and pre value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Namespaces

      public Namespaces()
      Empty constructor.
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns if no namespaces exist. Note that the container size does not change if namespaces are deleted. This function is mainly used to decide namespaces need to be considered in query optimizations.
      Returns:
      result of check
    • size

      public int size()
      Returns the number of namespaces that have been stored so far.
      Returns:
      number of entries
    • uri

      public byte[] uri(int id)
      Returns a namespace URI for the name with the specified id.
      Parameters:
      id - id of namespace URI (0: no namespace)
      Returns:
      namespace URI or null
    • uriId

      public int uriId(byte[] uri)
      Returns the id of the specified namespace uri.
      Parameters:
      uri - namespace URI
      Returns:
      id, or 0 if no entry is found
    • uriIdForPrefix

      public int uriIdForPrefix(byte[] prefix, boolean element)
      Returns the id of a namespace URI for the specified prefix.
      Parameters:
      prefix - prefix
      element - indicates if the prefix belongs to an element or attribute name
      Returns:
      id of namespace uri, or 0 if no entry is found
    • uriIdForPrefix

      public int uriIdForPrefix(byte[] prefix, int pre, Data data)
      Returns the id of a namespace URI for the specified prefix and pre value.
      Parameters:
      prefix - prefix
      pre - pre value
      data - data reference
      Returns:
      id of namespace uri, or 0 if no entry is found
    • open

      public void open()
      Increases the level counter and sets a new default namespace.
    • open

      public void open(int pre, Atts atts)
      Adds namespaces to a new namespace child node and sets this node as new cursor.
      Parameters:
      pre - pre value
      atts - namespaces
    • add

      public int add(int pre, byte[] prefix, byte[] uri, Data data)
      Adds a single namespace for the specified pre value.
      Parameters:
      pre - pre value
      prefix - prefix
      uri - namespace uri
      data - data reference
      Returns:
      id of namespace uri
    • close

      public void close(int pre)
      Closes a namespace node.
      Parameters:
      pre - current pre value
    • delete

      public void delete(byte[] uri)
      Deletes the specified namespace URI from the root node.
      Parameters:
      uri - namespace URI reference
    • info

      public byte[] info()
      Returns namespace information.
      Returns:
      info string
    • toString

      public String toString()
      Overrides:
      toString in class Object