Interface XQueryService

All Superinterfaces:
Configurable, Service

public interface XQueryService extends Service
  • Field Details

  • Method Details

    • setNamespace

      void setNamespace(String prefix, String uri) throws XMLDBException
      Sets a namespace mapping in the internal namespace map used to evaluate queries. If prefix is null or empty the default namespace is associated with the provided URI. A null or empty uri results in an exception being thrown.
      Parameters:
      prefix - The prefix to set in the map. If prefix is empty or null the default namespace will be associated with the provided URI.
      uri - The URI for the namespace to be associated with prefix.
      Throws:
      XMLDBException
    • getNamespace

      String getNamespace(String prefix) throws XMLDBException
      Returns the URI string associated with prefix from the internal namespace map. If prefix is null or empty the URI for the default namespace will be returned. If a mapping for the prefix can not be found null is returned.
      Parameters:
      prefix - The prefix to retrieve from the namespace map.
      Returns:
      The URI associated with prefix
      Throws:
      XMLDBException - with expected error codes.
      ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.
    • removeNamespace

      void removeNamespace(String prefix) throws XMLDBException
      Removes the namespace mapping associated with prefix from the internal namespace map. If prefix is null or empty the mapping for the default namespace will be removed.
      Parameters:
      prefix - The prefix to remove from the namespace map. If prefix is null or empty the mapping for the default namespace will be removed.
      Throws:
      XMLDBException - with expected error codes.
      ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.
    • clearNamespaces

      void clearNamespaces() throws XMLDBException
      Throws:
      XMLDBException
    • query

      ResourceSet query(String query) throws XMLDBException
      Throws:
      XMLDBException
    • queryResource

      ResourceSet queryResource(String id, String query) throws XMLDBException
      Throws:
      XMLDBException
    • compile

      CompiledExpression compile(String query) throws XMLDBException
      Compiles the specified XQuery and returns a handle to the compiled code, which can then be passed to execute(org.xmldb.api.base.CompiledExpression).
      Throws:
      XMLDBException
    • execute

      ResourceSet execute(CompiledExpression expression) throws XMLDBException
      Execute a compiled XQuery. The implementation should pass all namespaces and variables declared through XQueryService to the compiled XQuery code.
      Throws:
      XMLDBException
    • declareVariable

      void declareVariable(String qname, Object initialValue) throws XMLDBException
      Declare a global, external XQuery variable and assign a value to it. The variable has the same status as a variable declare through the declare variable statement in the XQuery prolog. The variable can be referenced inside the XQuery expression as $variable. For example, if you declare a variable with
              declareVariable("name", "HAMLET");
       
      you may use the variable in an XQuery expression as follows:
              //SPEECH[SPEAKER=$name]
       
      Parameters:
      qname - a valid QName by which the variable is identified. Any prefix should have been mapped to a namespace, using setNamespace(String, String). For example, if a variable is called x:name, a prefix/namespace mapping should have been defined for prefix x before calling this method.
      initialValue - the initial value, which is assigned to the variable
      Throws:
      XMLDBException
    • setXPathCompatibility

      void setXPathCompatibility(boolean backwardsCompatible)
      Enable or disable XPath 1.0 compatibility mode. In XPath 1.0 compatibility mode, some XQuery expressions will behave different. In particular, additional automatic type conversions will be applied to the operands of numeric operators.
      Parameters:
      backwardsCompatible -
    • setModuleLoadPath

      void setModuleLoadPath(String path)