0
我正在使用xqj api來實現Java中的XQuery,下面是一個示例查詢,我得到了它的工作原理。我需要將查詢的輸出寫入.xml文件,請幫助我嗎?將xquery結果保存到xml文件中
String queryString =
"declare variable $docName as xs:string external;" + sep +
"for $cat in doc($docName)/*/"+ objectName +
" where $cat/"+field+" > "+ value +
" order by $cat/" + field + " "+
"return $cat";
XQExpression expression = conn.createExpression();
expression.bindString(new QName("docName"), filename,
conn.createAtomicType(XQItemType.XQBASETYPE_STRING));
XQSequence results = expression.executeQuery(queryString);
System.out.println(results.getSequenceAsString(new Properties()));
感謝邁克爾·凱。 – Lucy