/** * Initializes the handle with a DOM document for the content. * @param content a DOM document */ public DOMHandle(Document content) { this(); set(content); }
handle.set(readDoc);
/** * Initializes the handle with a DOM document for the content. * @param content a DOM document */ public DOMHandle(Document content) { this(); set(content); }
/** * Assigns a DOM document as the content and returns the handle * as a fluent convenience. * @param content a DOM document * @return this handle */ public DOMHandle with(Document content) { set(content); return this; }
/** * Assigns a DOM document as the content and returns the handle * as a fluent convenience. * @param content a DOM document * @return this handle */ public DOMHandle with(Document content) { set(content); return this; }
handle.set(doc);
/** * Update document using DOMHandle * * @param client * @param filename * @param uri * @param type * @throws IOException * @throws ParserConfigurationException * @throws SAXException */ public void updateDocumentUsingDOMHandle(DatabaseClient client, String filename, String uri, String type) throws IOException, ParserConfigurationException, SAXException { // create doc manager DocumentManager docMgr = null; docMgr = documentManagerSelector(client, docMgr, type); // acquire the content DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbfac.newDocumentBuilder(); Document content = docBuilder.parse(new File("src/test/java/com/marklogic/client/functionaltest/data/" + filename)); // create an identifier for the document String docId = uri; // create a handle on the content DOMHandle handle = new DOMHandle(); handle.set(content); // write the document content docMgr.write(docId, handle); System.out.println("Update " + docId + " to database"); }
/** * Write document using DOMHandle * * @param client * @param filename * @param uri * @param type * @throws IOException * @throws ParserConfigurationException * @throws SAXException */ public void writeDocumentUsingDOMHandle(DatabaseClient client, String filename, String uri, String type) throws IOException, ParserConfigurationException, SAXException { // create doc manager DocumentManager docMgr = null; docMgr = documentManagerSelector(client, docMgr, type); // acquire the content DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbfac.newDocumentBuilder(); Document content = docBuilder.parse(new File("src/test/java/com/marklogic/client/functionaltest/data/" + filename)); // create an identifier for the document String docId = uri + filename; // create a handle on the content DOMHandle handle = new DOMHandle(); handle.set(content); // write the document content docMgr.write(docId, handle); System.out.println("Write " + docId + " to database"); }
dHandle.set(readDoc); before = dHandle.toBuffer(); strBefore = new String(before);
writeMetadataHandle.set(docMetadata);
writeMetadataHandle.set(docMetadata);
writeMetadataHandle.set(docMetadata);
writeMetadataHandle.set(docMetadata);
writeMetadataHandle.set(docMetadata);
writeMetadataHandle.set(docMetadata);
writeMetadataHandle.set(docMetadata);