public String queryDocumentFromCollection() //throws XQException { String query = "for $doc in fn:collection()\n" + "return $doc\n"; XQExpression xqe = xqConn.createExpression(); XQResultSequence xqs = xqe.executeQuery(query); String result = null; if (xqs.next()) { result = xqs.getItemAsString(null); } return(result); }
public String readDocument(String uri) //throws XQException { String query = "declare namespace bgdb=\"http://bagridb.com/bdb\";\n" + "declare variable $uri external;\n" + "let $doc := bgdb:get-document-content($uri)\n" + "return $doc\n"; XQPreparedExpression xqpe = xqConn.prepareExpression(query); xqpe.bindString(new QName("uri"), uri, xqConn.createAtomicType(8)); //XQItemType.XQBASETYPE_ANYURI)); XQResultSequence xqs = xqpe.executeQuery(); String result = null; if (xqs.next()) { result = xqs.getItemAsString(null); } return(result); }