You use the removeItems() method of the atg.repository.xml.RemoveService class to delete repository items specified in XML documents. This method takes an XML document in the form of a String array, a java.io.Reader, or a java.io.inputStream.

Some versions of removeItems() take a matchProperties String array. Property matching for RemoveService.removeItems() uses the same logic as UpdateService.updateItem(), except it is legal for multiple repository items to be marked for deletion. For example, an instance document to remove all users whose date of birth is 02-06-1975 would look like:

<user:user xmlns:user="http://www.atg.com/ns/UserProfiles/user"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.atg.com/ns/UserProfiles/user
 UserProfiles+user.xsd " ID="user747">
 <user:user.dateOfBirth>02-06-1975</user:user.dateOfBirth>
</user:user>

The application then uses the following code to remove all the user repository items whose dateOfBirth value is 02-06-1975 (assuming the inputXML String contains the instance document shown above):

String[] matchProperties = {"dateOfBirth"};
String[] removedItemIds =
 RemoveService.removeItem(inputXML,matchProperties);

The maximum number of matching items is specified by the maxSelectedItems property of RemoveService. If the number of matching repository items exceeds this value, an exception is thrown. In the /atg/repository/xml/RemoveService component, maxSelectedItems is set to 5 by default.