case 0: style = XPathQueryResolver.STYLE_XPATH; break;
case 1: style = FullTextQueryResolver.STYLE_FULLTEXT; break;
case 2: style = XSLTQueryResolver.STYLE_XSLT; break;
default: style = XUpdateQueryResolver.STYLE_XUPDATE; break;
}
ResultSetClient rs = col.queryCollection(style, query, cfg.getNamespaceMap());
sw.stop();
statusBar.setText(sw.toString());
Document doc = DOMHelper.newDocument();
Element root = doc.createElementNS(Query.NSURI, Query.PREFIX+":"+ResultSetWrapper.RESULTS);
String colName = rs.getCollection().getCanonicalName();
root.setAttribute("xmlns:"+Query.PREFIX, Query.NSURI);
root.setAttribute(ResultSetWrapper.COL, colName);
int count = rs.getCount();
if ( count != -1 )
root.setAttribute(ResultSetWrapper.COUNT, Integer.toString(count));
doc.appendChild(root);
root.appendChild(doc.createTextNode("\n"));
while ( rs.next() ) {
Node n = rs.getResult();
Element result = doc.createElementNS(Query.NSURI, Query.PREFIX+":"+ResultSetWrapper.RESULT);
result.appendChild(doc.createTextNode("\n"));
CollectionClient rc = rs.getResultCollection();
String rsColName = rc.getCanonicalName();
if ( !rsColName.equals(colName) )
result.setAttribute(ResultSetWrapper.COL, rsColName);
String key = rs.getResultKey();
if ( key != null && key.length() > 0 )
result.setAttribute(ResultSetWrapper.KEY, key);
result.appendChild(doc.importNode(n, true));
result.appendChild(doc.createTextNode("\n"));
root.appendChild(result);