Created
May 2, 2013 14:10
-
-
Save ableasdale/5502456 to your computer and use it in GitHub Desktop.
XCC/J Document Delete Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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