%@ page session="true" isThreadSafe="true" isErrorPage="false"%><%@ page import="java.util.ArrayList" %>
<%@ page import="org.xmldb.api.*" %>
<%@ page import="org.xmldb.api.base.*" %>
<%@ page import="org.xmldb.api.modules.*" %>
<%@ page import="org.w3c.dom.*" %>
<%@ page import="org.exist.xmldb.XQueryService" %>
<%@ page import="org.exist.security.MD5" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<%!
// Declarations
String reposUri = "xmldb:exist://localhost:8080/exist/xmlrpc/db";
public void initDBManager() throws Exception {
String driver = "org.exist.xmldb.DatabaseImpl";
Class cl = Class.forName(driver);
Database dbrepository = (Database)cl.newInstance();
DatabaseManager.registerDatabase(dbrepository);
}
%><% // Instream code
try {
initDBManager();
String colpath = "mdc-public";
Collection col = DatabaseManager.getCollection(reposUri+"/"+colpath,"admin","");
String xqstr =
"declare namespace util=\"http://exist-db.org/xquery/util\";\n"+
"declare namespace m=\"http://www.loc.gov/mods/v3\";\n"+
"let $col := xcollection('/db/mdc-public')\n"+
"for $p in //m:recordInfo[m:recordContentSource &= 'mdc-header']\n"+
"let $root := $p/ancestor::m:mods\n"+
"return $root\n";
XQueryService service = (XQueryService) col.getService("XQueryService", "1.0");
service.setProperty("indent", "yes");
service.setProperty("highlight-matches", "none");
ResourceSet result = service.query(xqstr);
System.out.println("result size:"+result.getSize());
for (int i=0; i
OK
Test