if (start < 0 || start > hitsByDoc.getLength())
{throw new RemoteException(
"index " + start + "out of bounds (" + hitsByDoc.getLength() + ")");}
if (start + howmany >= hitsByDoc.getLength())
{howmany = hitsByDoc.getLength() - start;}
final Serializer serializer = broker.getSerializer();
serializer.reset();
serializer.setProperty(OutputKeys.INDENT, indent ? "yes" : "no");
serializer.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, xinclude ? "yes" : "no");
serializer.setProperty(EXistOutputKeys.HIGHLIGHT_MATCHES, highlight);
xml = new String[howmany];
int j=0;
for (int i = start; i < start + howmany; i++) {
final NodeProxy proxy = ((NodeSet) hitsByDoc).get(i);
if (proxy == null)
{throw new RuntimeException("not found: " + start);}
xml[j] = serializer.serialize(proxy);
j++; // update count number of results
}
} else
{throw new RemoteException("result set is not a node list");}
return xml;