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 TypeMethodDescriptionvoidRemoves 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 theCollectionassociated with this service.voidremoveNamespace(String prefix) Removes the namespace mapping associated withprefix.voidsetCollection(Collection col) Sets the Collection attribute of the Service objectvoidsetNamespace(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, setPropertyMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
-
Constructor Details
-
SimpleXPathQueryService
public SimpleXPathQueryService()
-
-
Method Details
-
getName
Returns the service name- Specified by:
getNamein interfaceService- Returns:
- the name of the object.
- Throws:
XMLDBException- with expected error codes.
ErrorCodes.VENDOR_ERRORfor any vendor specific errors that occur.
-
getVersion
Returns the version of the Service- Specified by:
getVersionin interfaceService- Returns:
- The Version value
- Throws:
XMLDBException- with expected error codes.
ErrorCodes.VENDOR_ERRORfor any vendor specific errors that occur.
-
setCollection
Sets the Collection attribute of the Service object- Specified by:
setCollectionin interfaceService- Parameters:
col- The new Collection value- Throws:
XMLDBException- with expected error codes.
ErrorCodes.VENDOR_ERRORfor any vendor specific errors that occur.
-
setNamespace
Sets a namespace mapping in the internal namespace map used to evaluate queries.- Specified by:
setNamespacein interfaceXPathQueryService- Parameters:
prefix- The prefix to set in the map. Ifprefixis 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_ERRORfor any vendor specific errors that occur.
TODO: probably need some special error here.
-
getNamespace
Returns the URI string associated withprefix.- Specified by:
getNamespacein 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_ERRORfor any vendor specific errors that occur.
-
removeNamespace
Removes the namespace mapping associated withprefix.- Specified by:
removeNamespacein interfaceXPathQueryService- Parameters:
prefix- The prefix to remove from the namespace map. Ifprefixis null or empty the mapping for the default namespace will be removed.- Throws:
XMLDBException- with expected error codes.
ErrorCodes.VENDOR_ERRORfor any vendor specific errors that occur.
-
clearNamespaces
Removes all namespace mappings stored in the internal namespace map.- Specified by:
clearNamespacesin interfaceXPathQueryService- Throws:
XMLDBException- with expected error codes.
ErrorCodes.VENDOR_ERRORfor any vendor specific errors that occur.
-
query
Run an XPath query againt theCollection. The result is aResourceIteratorcontaining the results of the query.- Specified by:
queryin 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_ERRORfor any vendor specific errors that occur.
-
queryResource
Run an XPath query against an XML resource stored in theCollectionassociated with this service. The result is aResourceSetcontaining the results of the query.- Specified by:
queryResourcein interfaceXPathQueryService- Parameters:
id- The id of the document to run the query against.query- The XPath query string to use.- Returns:
- A
ResourceSetcontaining the results of the query. - Throws:
XMLDBException- with expected error codes.
ErrorCodes.VENDOR_ERRORfor any vendor specific errors that occur.
-