From: TMG <tm...@nc...> - 2005-01-21 08:44:33
|
I could use help from list in trying to figure out the best way to remove a document from a collection when it no longer holds any elements (or meets some xpath criteria). For example, if I use xupdate to locate and remove a node from within a document, and there are no child nodes left in the document as a result, how can I delete the whole document. For example, if I have the xml: <?xml version="1.0" encoding="UTF-8"?> <startElement> <childNode>6</childNode> </startElement> And I run a xupdate: <?xml version="1.0"?> <xu:modifications version="1.0" xmlns:xu="http://www.xmldb.org/xupdate"> <xu:remove select="/startElement/childNode[text() = '6']"/> </xu:modifications> The above example is contrived in that it only has one "childNode" element, but imagine a resource (xml document) with many childNodes being removed one at a time. I would like to remove the collection's resource if there isn't anymore "childNodes" left in the resource. Any ideas? What I have been doing is running a second query to count how many childNode's are left, and if zero then delete the resource, but I am hoping I've missed something in the API that crosses the bridge between managing items in a resource with the actual resource. Thanks in advance, Tom Gordon |