Package org.basex.data
Class Namespaces
java.lang.Object
org.basex.data.Namespaces
This class organizes the namespaces of a database.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintAdds a single namespace for the specified pre value.voidclose(int pre) Closes a namespace node.voiddelete(byte[] uri) Deletes the specified namespace URI from the root node.byte[]info()Returns namespace information.booleanisEmpty()Returns if no namespaces exist.voidopen()Increases the level counter and sets a new default namespace.voidAdds namespaces to a new namespace child node and sets this node as new cursor.intsize()Returns the number of namespaces that have been stored so far.toString()byte[]uri(int id) Returns a namespace URI for the name with the specified id.inturiId(byte[] uri) Returns the id of the specified namespace uri.inturiIdForPrefix(byte[] prefix, boolean element) Returns the id of a namespace URI for the specified prefix.inturiIdForPrefix(byte[] prefix, int pre, Data data) Returns the id of a namespace URI for the specified prefix and pre value.
-
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
0if 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- prefixelement- indicates if the prefix belongs to an element or attribute name- Returns:
- id of namespace uri, or
0if no entry is found
-
uriIdForPrefix
Returns the id of a namespace URI for the specified prefix and pre value.- Parameters:
prefix- prefixpre- pre valuedata- data reference- Returns:
- id of namespace uri, or
0if no entry is found
-
open
public void open()Increases the level counter and sets a new default namespace. -
open
Adds namespaces to a new namespace child node and sets this node as new cursor.- Parameters:
pre- pre valueatts- namespaces
-
add
Adds a single namespace for the specified pre value.- Parameters:
pre- pre valueprefix- prefixuri- namespace uridata- 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
-