org.sixdml.xindice
Class xiSixdmlUpdateService

java.lang.Object
  |
  +--org.sixdml.xindice.xiServiceBase
        |
        +--org.sixdml.xindice.xiNamespaceAwareService
              |
              +--org.sixdml.xindice.xiSixdmlUpdateService
All Implemented Interfaces:
Configurable, Service, SixdmlConstants, SixdmlUpdateService

class xiSixdmlUpdateService
extends xiNamespaceAwareService
implements SixdmlUpdateService, SixdmlConstants

  
 xlnSixdmlUpdateService.java

 Used to update nodes in collections or documents via  XPath queries.
 

Version:
1.0

Fields inherited from class org.sixdml.xindice.xiNamespaceAwareService
namespaceMap
 
Fields inherited from class org.sixdml.xindice.xiServiceBase
collection, properties
 
Fields inherited from interface org.sixdml.SixdmlConstants
SIXDML_NS, SIXDML_VERSION
 
Constructor Summary
(package private) xiSixdmlUpdateService()
          Default constructor initializes service.
 
Method Summary
 int delete(String query, SixdmlCollection collection)
          Deletes all nodes that match the expression from the target document.
 int delete(String query, SixdmlResource resource)
          Deletes all nodes that match the expression from the target document.
 int delete(String query, String predicate, SixdmlCollection collection)
          Deletes all nodes that match the expression from the target document.
 String getName()
          Gets the name of the service.
 int insertAttribute(String query, SixdmlCollection collection, String name, String value)
          Inserts an attribute node as a child of each of the nodes returned from the XPath query.
 int insertAttribute(String query, SixdmlCollection collection, String name, String value, String namespaceURI)
          Inserts an attribute node as a child of each of the nodes returned from the XPath query.
 int insertAttribute(String query, SixdmlResource resource, String name, String value)
          Inserts an attribute node as a child of each of the nodes returned from the XPath query.
 int insertAttribute(String query, SixdmlResource resource, String name, String value, String namespaceURI)
          Inserts an attribute node as a child of each of the nodes returned from the XPath query.
 int insertAttribute(String query, String predicate, SixdmlCollection collection, String name, String value)
          Inserts an attribute node as a child of each of the nodes returned from the XPath query.
 int insertAttribute(String query, String predicate, SixdmlCollection collection, String name, String value, String namespaceURI)
          Inserts an attribute node as a child of each of the nodes returned from the XPath query.
 int insertChild(String query, NodeList nodes, SixdmlCollection collection)
          Inserts a node as a child of each of the nodes returned from the XPath query.
 int insertChild(String query, NodeList nodes, SixdmlResource resource)
          Inserts a node as a child of each of the nodes returned from the XPath query.
 int insertChild(String query, String predicate, NodeList nodes, SixdmlCollection collection)
          Inserts a node as a child of each of the nodes returned from the XPath query.
 int insertChild(String query, String fragment, SixdmlCollection collection)
          Inserts an XML fragment as a child of each of the nodes returned from the XPath query.
 int insertChild(String query, String fragment, SixdmlResource resource)
          Inserts an XML fragment as a child of each of the nodes returned from the XPath query.
 int insertChild(String query, String predicate, String fragment, SixdmlCollection collection)
          Inserts an XML fragment as a child of each of the nodes returned from the XPath query.
 int insertSibling(String query, NodeList nodes, SixdmlCollection collection, boolean before)
          Inserts a node as a sibling of each of the nodes returned from the XPath query.
 int insertSibling(String query, NodeList nodes, SixdmlResource resource, boolean before)
          Inserts a node as a sibling of each of the nodes returned from the XPath query.
 int insertSibling(String query, String predicate, NodeList nodes, SixdmlCollection collection, boolean before)
          Inserts a node as a sibling of each of the nodes returned from the XPath query.
 int insertSibling(String query, String fragment, SixdmlCollection collection, boolean before)
          Inserts an XML fragment as a sibling of each of the nodes returned from the XPath query.
 int insertSibling(String query, String fragment, SixdmlResource resource, boolean before)
          Inserts an XML fragment as a sibling of each of the nodes returned from the XPath query.
 int insertSibling(String query, String predicate, String fragment, SixdmlCollection collection, boolean before)
          Inserts an XML fragment as a sibling of each of the nodes returned from the XPath query.
private static boolean isNodeOfType(short type, short[] nodetypes)
          Helper method that tests if a node is of a specific type.
(package private) static NodeList loadIntoNodeList(String xmlString)
          Creates a DOM node list from an XML fragment.
 int rename(String query, String name, String namespaceURI, SixdmlCollection collection)
          Renames one or more attribute or element nodes.
 int rename(String query, String name, String namespaceURI, SixdmlResource resource)
          Renames one or more attribute or element nodes.
 int rename(String query, String predicate, String name, String namespaceURI, SixdmlCollection collection)
          Renames one or more attribute or element nodes.
 int replace(String query, NodeList nodes, SixdmlCollection collection)
          Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
 int replace(String query, NodeList nodes, SixdmlResource resource)
          Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
 int replace(String query, String predicate, NodeList nodes, SixdmlCollection collection)
          Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
 int replace(String query, String fragment, SixdmlCollection collection)
          Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
 int replace(String query, String fragment, SixdmlResource resource)
          Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
 int replace(String query, String predicate, String fragment, SixdmlCollection collection)
          Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
 
Methods inherited from class org.sixdml.xindice.xiNamespaceAwareService
addNamespaceMapping, clearNamespaceMappings, getNamespaceMapping, getNamespaceNode, removeNamespaceMapping, setNamespaceMap
 
Methods inherited from class org.sixdml.xindice.xiServiceBase
getProperty, getVersion, setCollection, setProperty
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface org.sixdml.update.SixdmlUpdateService
addNamespaceMapping, clearNamespaceMappings, getNamespaceMapping, removeNamespaceMapping, setNamespaceMap
 
Methods inherited from interface org.xmldb.api.base.Service
getVersion, setCollection
 
Methods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
 

Constructor Detail

xiSixdmlUpdateService

xiSixdmlUpdateService()
Default constructor initializes service.
Method Detail

getName

public String getName()
Gets the name of the service.
Specified by:
getName in interface Service
Overrides:
getName in class xiServiceBase
Returns:
the name of the service.

isNodeOfType

private static boolean isNodeOfType(short type,
                                    short[] nodetypes)
Helper method that tests if a node is of a specific type.
Parameters:
type - the type of the node we are testing.
nodetypes - the array of nodes types we are interested in testing if this node is a member of.
Returns:
true if the node type is in the list of approved node types.

loadIntoNodeList

static NodeList loadIntoNodeList(String xmlString)
                          throws NonWellFormedXMLException
Creates a DOM node list from an XML fragment.
Parameters:
xmlString - the XML fragment.
Returns:
the DOM nodelist.
Throws:
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.

insertSibling

public int insertSibling(String query,
                         String fragment,
                         SixdmlResource resource,
                         boolean before)
                  throws XMLDBException,
                         InvalidQueryException,
                         NonWellFormedXMLException,
                         UpdateTypeMismatchException
Inserts an XML fragment as a sibling of each of the nodes returned from the XPath query. A boolean flag indicates whether the new node will be inserted before or after the selected nodes.
Specified by:
insertSibling in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
fragment - The XML fragment to insert
resource - the document to perform the update against
before - if this is true then the new node wil be inserted before each of the selected node while if it is false the new node will be inserted after the selected nodes in the tree.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is the document root and an attempt is made to insert anything besides comments or processing instructions.
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.

insertChild

public int insertChild(String query,
                       String fragment,
                       SixdmlResource resource)
                throws XMLDBException,
                       InvalidQueryException,
                       NonWellFormedXMLException,
                       UpdateTypeMismatchException
Inserts an XML fragment as a child of each of the nodes returned from the XPath query. A boolean flag indicates whether the new node will be inserted before or after the selected nodes. The new node is appended to the end of the current children of the selected node.
Specified by:
insertChild in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
fragment - The XML fragment to insert
resource - the document to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node, document node or set of element nodes.
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.

insertSibling

public int insertSibling(String query,
                         NodeList nodes,
                         SixdmlResource resource,
                         boolean before)
                  throws XMLDBException,
                         InvalidQueryException,
                         UpdateTypeMismatchException
Inserts a node as a sibling of each of the nodes returned from the XPath query. A boolean flag indicates whether the new node will be inserted before or after the selected nodes.
Specified by:
insertSibling in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
nodes - The DOM node(s) to insert
resource - the document to perform the update against
before - if this is true then the new node wil be inserted before each of the selcted node while if it is false the new node will be inserted after the selected nodes in the tree.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is the document root and an attempt is made to insert anything besides comments or processing instructions.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT

insertChild

public int insertChild(String query,
                       NodeList nodes,
                       SixdmlResource resource)
                throws XMLDBException,
                       InvalidQueryException,
                       UpdateTypeMismatchException
Inserts a node as a child of each of the nodes returned from the XPath query. A boolean flag indicates whether the new node will be inserted before or after the selected nodes. The new node is appended to the end of the current children of the selected node.
Specified by:
insertChild in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
nodes - The DOM node(s) to insert
resource - the document to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node, document node or set of element nodes.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT

insertAttribute

public int insertAttribute(String query,
                           SixdmlResource resource,
                           String name,
                           String value)
                    throws XMLDBException,
                           InvalidQueryException,
                           UpdateTypeMismatchException
Inserts an attribute node as a child of each of the nodes returned from the XPath query.
Specified by:
insertAttribute in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
resource - the document to perform the update against
name - The name of the attribute to insert.
value - the value of the attribute to insert.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node or set of element nodes.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT

insertAttribute

public int insertAttribute(String query,
                           SixdmlResource resource,
                           String name,
                           String value,
                           String namespaceURI)
                    throws XMLDBException,
                           InvalidQueryException,
                           UpdateTypeMismatchException
Inserts an attribute node as a child of each of the nodes returned from the XPath query.
Specified by:
insertAttribute in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
resource - the document to perform the update against
name - The name of the attribute to insert. It should be an XML qualified name.
value - the value of the attribute to insert.
prefix - the namespace prefix for the attribute node.
namespaceURI - the namsepace URI for the attribute node. If this is null then this operation is the same as inserting an attribute without a namespace.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node or set of element nodes.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT

delete

public int delete(String query,
                  SixdmlResource resource)
           throws XMLDBException,
                  InvalidQueryException
Deletes all nodes that match the expression from the target document.
Specified by:
delete in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to delete.
resource - the document to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.

replace

public int replace(String query,
                   String fragment,
                   SixdmlResource resource)
            throws XMLDBException,
                   InvalidQueryException,
                   NonWellFormedXMLException,
                   UpdateTypeMismatchException
Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
Specified by:
replace in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
fragment - the XML fragment to insert.
resource - the document to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not one or more comment, text, processing-instruction, or element nodes.
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT, ErrorMessages.MULTIPLE_ROOT_ELEMENTS, ErrorMessages.CANT_REPLACE_ATTRIBUTE

replace

public int replace(String query,
                   NodeList nodes,
                   SixdmlResource resource)
            throws XMLDBException,
                   InvalidQueryException,
                   UpdateTypeMismatchException
Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
Specified by:
replace in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
nodes - The DOM node(s) to insert
resource - the document to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not one or more comment, text, processing-instruction, or element nodes.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT, ErrorMessages.MULTIPLE_ROOT_ELEMENTS, ErrorMessages.CANT_REPLACE_ATTRIBUTE

rename

public int rename(String query,
                  String name,
                  String namespaceURI,
                  SixdmlResource resource)
           throws XMLDBException,
                  InvalidQueryException,
                  UpdateTypeMismatchException
Renames one or more attribute or element nodes.
Specified by:
rename in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
name - The new name. It can be a qualified name.
namespaceURI - the namespace URI for the element being inserted. If it is null then it is assumed the new item has no namespace URI.
resource - the document to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not one or more attribute or element nodes.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.RENAME_ERROR

insertSibling

public int insertSibling(String query,
                         String fragment,
                         SixdmlCollection collection,
                         boolean before)
                  throws XMLDBException,
                         InvalidQueryException,
                         NonWellFormedXMLException,
                         UpdateTypeMismatchException
Inserts an XML fragment as a sibling of each of the nodes returned from the XPath query. A boolean flag indicates whether the new node will be inserted before or after the selected nodes.
Specified by:
insertSibling in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
fragment - The XML fragment to insert
collection - the collection whose documents to perform the update against
before - if this is true then the new node wil be inserted before each of the selected node while if it is false the new node will be inserted after the selected nodes in the tree.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is the document root and an attempt is made to insert anything besides comments or processing instructions.
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.

insertSibling

public int insertSibling(String query,
                         String predicate,
                         String fragment,
                         SixdmlCollection collection,
                         boolean before)
                  throws XMLDBException,
                         InvalidQueryException,
                         NonWellFormedXMLException,
                         UpdateTypeMismatchException
Inserts an XML fragment as a sibling of each of the nodes returned from the XPath query. A boolean flag indicates whether the new node will be inserted before or after the selected nodes.
Specified by:
insertSibling in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
fragment - The XML fragment to insert
collection - the collection whose documents to perform the update against
before - if this is true then the new node wil be inserted before each of the selected node while if it is false the new node will be inserted after the selected nodes in the tree.
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is the document root and an attempt is made to insert anything besides comments or processing instructions.
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.

insertChild

public int insertChild(String query,
                       String fragment,
                       SixdmlCollection collection)
                throws XMLDBException,
                       InvalidQueryException,
                       NonWellFormedXMLException,
                       UpdateTypeMismatchException
Inserts an XML fragment as a child of each of the nodes returned from the XPath query. The new node is appended to the end of the current children of the selected node.
Specified by:
insertChild in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
fragment - The XML fragment to insert
collection - the collection whose documents to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node, document node or set of element nodes.
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.

insertChild

public int insertChild(String query,
                       String predicate,
                       String fragment,
                       SixdmlCollection collection)
                throws XMLDBException,
                       InvalidQueryException,
                       NonWellFormedXMLException,
                       UpdateTypeMismatchException
Inserts an XML fragment as a child of each of the nodes returned from the XPath query. The new node is appended to the end of the current children of the selected node.
Specified by:
insertChild in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
fragment - The XML fragment to insert
collection - the collection whose documents to perform the update against
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node, document node or set of element nodes.
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.

insertSibling

public int insertSibling(String query,
                         NodeList nodes,
                         SixdmlCollection collection,
                         boolean before)
                  throws XMLDBException,
                         InvalidQueryException,
                         UpdateTypeMismatchException
Inserts a node as a sibling of each of the nodes returned from the XPath query. A boolean flag indicates whether the new node will be inserted before or after the selected nodes.
Specified by:
insertSibling in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
nodes - The DOM node(s) to insert
collection - the collection whose documents to perform the update against
before - if this is true then the new node wil be inserted before each of the selcted node while if it is false the new node will be inserted after the selected nodes in the tree.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is the document root and an attempt is made to insert anything besides comments or processing instructions.

insertSibling

public int insertSibling(String query,
                         String predicate,
                         NodeList nodes,
                         SixdmlCollection collection,
                         boolean before)
                  throws XMLDBException,
                         InvalidQueryException,
                         UpdateTypeMismatchException
Inserts a node as a sibling of each of the nodes returned from the XPath query. A boolean flag indicates whether the new node will be inserted before or after the selected nodes.
Specified by:
insertSibling in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
nodes - The DOM node(s) to insert
collection - the collection whose documents to perform the update against
before - if this is true then the new node wil be inserted before each of the selcted node while if it is false the new node will be inserted after the selected nodes in the tree.
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is the document root and an attempt is made to insert anything besides comments or processing instructions.

insertChild

public int insertChild(String query,
                       NodeList nodes,
                       SixdmlCollection collection)
                throws XMLDBException,
                       InvalidQueryException,
                       UpdateTypeMismatchException
Inserts a node as a child of each of the nodes returned from the XPath query. The new node is appended to the end of the current children of the selected node.
Specified by:
insertChild in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
nodes - The DOM node(s) to insert
collection - the collection whose documents to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node, document node or set of element nodes.

insertChild

public int insertChild(String query,
                       String predicate,
                       NodeList nodes,
                       SixdmlCollection collection)
                throws XMLDBException,
                       InvalidQueryException,
                       UpdateTypeMismatchException
Inserts a node as a child of each of the nodes returned from the XPath query. The new node is appended to the end of the current children of the selected node.
Specified by:
insertChild in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
nodes - The DOM node(s) to insert
collection - the collection whose documents to perform the update against
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node, document node or set of element nodes.

insertAttribute

public int insertAttribute(String query,
                           SixdmlCollection collection,
                           String name,
                           String value)
                    throws XMLDBException,
                           InvalidQueryException,
                           UpdateTypeMismatchException
Inserts an attribute node as a child of each of the nodes returned from the XPath query.
Specified by:
insertAttribute in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
collection - the collection whose documents to perform the update against
name - The name of the attribute to insert.
value - the value of the attribute to insert.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node or set of element nodes.

insertAttribute

public int insertAttribute(String query,
                           String predicate,
                           SixdmlCollection collection,
                           String name,
                           String value)
                    throws XMLDBException,
                           InvalidQueryException,
                           UpdateTypeMismatchException
Inserts an attribute node as a child of each of the nodes returned from the XPath query.
Specified by:
insertAttribute in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
collection - the collection whose documents to perform the update against
name - The name of the attribute to insert.
value - the value of the attribute to insert.
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node or set of element nodes.

insertAttribute

public int insertAttribute(String query,
                           SixdmlCollection collection,
                           String name,
                           String value,
                           String namespaceURI)
                    throws XMLDBException,
                           InvalidQueryException,
                           UpdateTypeMismatchException
Inserts an attribute node as a child of each of the nodes returned from the XPath query.
Specified by:
insertAttribute in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
collection - the collection whose documents to perform the update against
name - The name of the attribute to insert. It should be an XML qualified name.
value - the value of the attribute to insert.
namespaceURI - the namsepace URI for the attribute node
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node or set of element nodes.

insertAttribute

public int insertAttribute(String query,
                           String predicate,
                           SixdmlCollection collection,
                           String name,
                           String value,
                           String namespaceURI)
                    throws XMLDBException,
                           InvalidQueryException,
                           UpdateTypeMismatchException
Inserts an attribute node as a child of each of the nodes returned from the XPath query.
Specified by:
insertAttribute in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
collection - the collection whose documents to perform the update against
name - The name of the attribute to insert. It should be an XML qualified name.
value - the value of the attribute to insert.
namespaceURI - the namsepace URI for the attribute node
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not an element node or set of element nodes.

delete

public int delete(String query,
                  SixdmlCollection collection)
           throws XMLDBException,
                  InvalidQueryException
Deletes all nodes that match the expression from the target document.
Specified by:
delete in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to delete.
collection - the collection whose documents to perform the update against
Returns:
the number of nodes affected by the update.

delete

public int delete(String query,
                  String predicate,
                  SixdmlCollection collection)
           throws XMLDBException,
                  InvalidQueryException
Deletes all nodes that match the expression from the target document.
Specified by:
delete in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to delete.
collection - the collection whose documents to perform the update against
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.

replace

public int replace(String query,
                   String fragment,
                   SixdmlCollection collection)
            throws XMLDBException,
                   InvalidQueryException,
                   NonWellFormedXMLException,
                   UpdateTypeMismatchException
Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
Specified by:
replace in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
fragment - the XML fragment to insert.
collection - the collection whose documents to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not one or more comment, text, processing-instruction, or element nodes.
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT, ErrorMessages.MULTIPLE_ROOT_ELEMENTS, ErrorMessages.CANT_REPLACE_ATTRIBUTE

replace

public int replace(String query,
                   String predicate,
                   String fragment,
                   SixdmlCollection collection)
            throws XMLDBException,
                   InvalidQueryException,
                   NonWellFormedXMLException,
                   UpdateTypeMismatchException
Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
Specified by:
replace in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
fragment - the XML fragment to insert.
collection - the collection whose documents to perform the update against
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not one or more comment, text, processing-instruction, or element nodes.
NonWellFormedXMLException - if the XML fragment is not a valid XML fragment.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT, ErrorMessages.MULTIPLE_ROOT_ELEMENTS, ErrorMessages.CANT_REPLACE_ATTRIBUTE

replace

public int replace(String query,
                   NodeList nodes,
                   SixdmlCollection collection)
            throws XMLDBException,
                   InvalidQueryException,
                   UpdateTypeMismatchException
Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
Specified by:
replace in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
nodes - The DOM node(s) to insert
collection - the collection whose documents to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not one or more comment, text, processing-instruction, or element nodes.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT, ErrorMessages.MULTIPLE_ROOT_ELEMENTS, ErrorMessages.CANT_REPLACE_ATTRIBUTE

replace

public int replace(String query,
                   String predicate,
                   NodeList nodes,
                   SixdmlCollection collection)
            throws XMLDBException,
                   InvalidQueryException,
                   UpdateTypeMismatchException
Replaces one or more element, processing-instruction, comment, or text nodes with the new node.
Parameters:
query - The query which selects the nodes to update
nodes - The DOM node(s) to insert
collection - the collection whose documents to perform the update against
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not one or more comment, text, processing-instruction, or element nodes.
See Also:
ErrorMessages.NODES_NOT_RETURNED, ErrorMessages.BAD_UPDATE_ATTEMPT, ErrorMessages.MULTIPLE_ROOT_ELEMENTS, ErrorMessages.CANT_REPLACE_ATTRIBUTE

rename

public int rename(String query,
                  String name,
                  String namespaceURI,
                  SixdmlCollection collection)
           throws XMLDBException,
                  InvalidQueryException,
                  UpdateTypeMismatchException
Renames one or more attribute or element nodes.
Specified by:
rename in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
name - The new name
namespaceURI - the namespace URI for the element being inserted. If it is null then it is assumed the new item has no namespace URI.
collection - the collection whose documents to perform the update against
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not one or more comment, text, processing-instruction, or element nodes.

rename

public int rename(String query,
                  String predicate,
                  String name,
                  String namespaceURI,
                  SixdmlCollection collection)
           throws XMLDBException,
                  InvalidQueryException,
                  UpdateTypeMismatchException
Renames one or more attribute or element nodes.
Specified by:
rename in interface SixdmlUpdateService
Parameters:
query - The query which selects the nodes to update
name - The new name
namespaceURI - the namespace URI for the element being inserted. If it is null then it is assumed the new item has no namespace URI.
collection - the collection whose documents to perform the update against
predicate - a filter expression used to determine which documents to update within the collection.
Returns:
the number of nodes affected by the update.
Throws:
XMLDBException - if a database error occurs during the insertion.
InvalidQueryException - if the XPath query is invalid.
UpdateTypeMismatchException - if the target node is not one or more comment, text, processing-instruction, or element nodes.