Hi all,
I have a big database and I would like to remove all documents stored in my db before a specified date.
The xml documents don’t include any attributes or elements with tha date field.
How can I solve the problem ?
reagrds
Cristian
Hi all,
I have a big database and I would like to remove all documents stored in my db before a specified date.
The xml documents don’t include any attributes or elements with tha date field.
How can I solve the problem ?
reagrds
Cristian
Right now the only way is to check the lasModified property of each document
It works like this
do the query doctype/@ino:id
for each node build up the URL like this
collection URL+‘/’+‘doctype’+‘/@’+ino:id
then do a HEAD on this URI and read the last modified date from the HTTP headers
If it is too old delete the document
in JScript DOM API it is something like this
var client= new TaminoClient(collectionURL,50)
var result= client.query(doctype/@ino:id);
while (result and result.nodes()) {
for (var i=0;i<result.nodes().length;i++){
var uri=doctype+‘/@’
+ result.nodes().item(i).getAttribute (“ino:id”);
var r=client.head(uri);
if (!r.errorNo ) {
var date=r.getlastModified();
if (… date…) //too old
client.deleteDocument(uri);
}
}
result=result.getNext();
}
You can do a similar job with the other APIs or the new Java API
[This message was edited by Nigel Hutchison on 20 Dec 2001 at 12:02.]