org.xmldb.api.sdk.modules
Class SimpleXPathQueryService
- Configurable, Service, XPathQueryService
public abstract class SimpleXPathQueryService
XPathQueryService is a Service
that enables the execution of
XPath queries within the context of a Collection
.
void | clearNamespaces() - Removes all namespace mappings stored in the internal namespace map.
|
String | getName() - Returns the service name
|
String | getNamespace(String prefix) - Returns the URI string associated with
prefix .
|
String | getVersion() - Returns the version of the Service
|
ResourceSet | query(String query) - Run an XPath query againt the
Collection .
|
ResourceSet | queryResource(String id, String query) - Run an XPath query against an XML resource stored in the
Collection associated with this service.
|
void | removeNamespace(String prefix) - Removes the namespace mapping associated with
prefix .
|
void | setCollection(Collection col) - Sets the Collection attribute of the Service object
|
void | setNamespace(String prefix, String uri) - Sets a namespace mapping in the internal namespace map used to evaluate
queries.
|
version
protected String version
SimpleXPathQueryService
public SimpleXPathQueryService()
getNamespace
public String getNamespace(String prefix)
throws XMLDBException
Returns the URI string associated with prefix
.
- getNamespace in interface XPathQueryService
prefix
- The prefix to retrieve from the namespace map.
- The URI associated with
prefix
query
public ResourceSet query(String query)
throws XMLDBException
Run an XPath query againt the Collection
. The result is a
ResourceIterator
containing the results of the query.
- query in interface XPathQueryService
query
- The XPath query string to use.
- A ResourceIterator containing the results of the query.
queryResource
public ResourceSet queryResource(String id,
String query)
throws XMLDBException
Run an XPath query against an XML resource stored in the
Collection
associated with this service. The result is a
ResourceSet
containing the results of the query.
- queryResource in interface XPathQueryService
id
- The id of the document to run the query against.query
- The XPath query string to use.
- A
ResourceSet
containing the results of the query.
removeNamespace
public void removeNamespace(String prefix)
throws XMLDBException
Removes the namespace mapping associated with prefix
.
- removeNamespace in interface XPathQueryService
prefix
- The prefix to remove from the namespace map. If
prefix
is null or empty the mapping for the default
namespace will be removed.
setCollection
public void setCollection(Collection col)
throws XMLDBException
Sets the Collection attribute of the Service object
- setCollection in interface Service
col
- The new Collection value
XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.
setNamespace
public void setNamespace(String prefix,
String uri)
throws XMLDBException
Sets a namespace mapping in the internal namespace map used to evaluate
queries.
- setNamespace in interface XPathQueryService
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.