Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created May 2, 2013 14:10
Show Gist options
  • Save ableasdale/5502456 to your computer and use it in GitHub Desktop.
Save ableasdale/5502456 to your computer and use it in GitHub Desktop.
XCC/J Document Delete Template
import com.marklogic.xcc.*;
import com.marklogic.xcc.exceptions.RequestException;
import java.net.URI;
public class XccDeleteModule {
public static void main(String[] args){
System.out.println("XccDeleteModule.main: start");
ContentSource cs = null;
try {
cs = ContentSourceFactory.newContentSource(new URI("xcc://[user]:[pass]@[host]:[port]/[database]"));
} catch (Exception e) {
e.printStackTrace();
}
Session s = cs.newSession();
Request r = s.newAdhocQuery ("xdmp:document-delete(xdmp:node-uri(doc()[1]))");
try {
s.submitRequest(r);
} catch (RequestException e) {
e.printStackTrace();
}
System.out.println("XccDeleteModule.main: End");
s.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment