Package org.xmldb.api.sdk.modules
Class SimpleXPathQueryService
java.lang.Object
org.xmldb.api.sdk.SimpleConfigurable
org.xmldb.api.sdk.modules.SimpleXPathQueryService
- All Implemented Interfaces:
Configurable
,Service
,XPathQueryService
- Direct Known Subclasses:
XPathQueryServiceImpl
public abstract class SimpleXPathQueryService
extends SimpleConfigurable
implements XPathQueryService
XPathQueryService is a
Service
that enables the execution of
XPath queries within the context of a Collection
.-
Field Summary
Fields inherited from interface org.xmldb.api.modules.XPathQueryService
SERVICE_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes all namespace mappings stored in the internal namespace map.getName()
Returns the service namegetNamespace
(String prefix) Returns the URI string associated withprefix
.Returns the version of the ServiceRun an XPath query againt theCollection
.queryResource
(String id, String query) Run an XPath query against an XML resource stored in theCollection
associated with this service.void
removeNamespace
(String prefix) Removes the namespace mapping associated withprefix
.void
setCollection
(Collection col) Sets the Collection attribute of the Service objectvoid
setNamespace
(String prefix, String uri) Sets a namespace mapping in the internal namespace map used to evaluate queries.Methods inherited from class org.xmldb.api.sdk.SimpleConfigurable
getProperty, setProperty
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
-
Constructor Details
-
SimpleXPathQueryService
public SimpleXPathQueryService()
-
-
Method Details
-
getName
Returns the service name- Specified by:
getName
in interfaceService
- Returns:
- the name of the object.
- Throws:
XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor specific errors that occur.
-
getVersion
Returns the version of the Service- Specified by:
getVersion
in interfaceService
- Returns:
- The Version value
- Throws:
XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor specific errors that occur.
-
setCollection
Sets the Collection attribute of the Service object- Specified by:
setCollection
in interfaceService
- Parameters:
col
- The new Collection value- Throws:
XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor specific errors that occur.
-
setNamespace
Sets a namespace mapping in the internal namespace map used to evaluate queries.- Specified by:
setNamespace
in interfaceXPathQueryService
- Parameters:
prefix
- The prefix to set in the map. Ifprefix
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
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor specific errors that occur.
TODO: probably need some special error here.
-
getNamespace
Returns the URI string associated withprefix
.- Specified by:
getNamespace
in interfaceXPathQueryService
- 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
Removes the namespace mapping associated withprefix
.- Specified by:
removeNamespace
in interfaceXPathQueryService
- Parameters:
prefix
- The prefix to remove from the namespace map. Ifprefix
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
Removes all namespace mappings stored in the internal namespace map.- Specified by:
clearNamespaces
in interfaceXPathQueryService
- Throws:
XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor specific errors that occur.
-
query
Run an XPath query againt theCollection
. The result is aResourceIterator
containing the results of the query.- Specified by:
query
in interfaceXPathQueryService
- Parameters:
query
- The XPath query string to use.- Returns:
- A ResourceIterator containing the results of the query.
- Throws:
XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor specific errors that occur.
-
queryResource
Run an XPath query against an XML resource stored in theCollection
associated with this service. The result is aResourceSet
containing the results of the query.- Specified by:
queryResource
in interfaceXPathQueryService
- Parameters:
id
- The id of the document to run the query against.query
- The XPath query string to use.- Returns:
- A
ResourceSet
containing the results of the query. - Throws:
XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor specific errors that occur.
-