} finally { DOMSerializerPool.getInstance().returnDOMSerializer(serializer);
	protected String printValues(		Sequence result,		int howmany,		int start,		boolean prettyPrint)		throws Exception {		if (result.getLength() == 0)			return "<?xml version=\"1.0\"?>\n"				+ "<exist:result xmlns:exist=\"http://exist.sourceforge.net/NS/exist\" "				+ "hitCount=\"0\"/>";		if (howmany > result.getLength() || howmany == 0)			howmany = result.getLength();		if (start < 1 || start > result.getLength())			throw new EXistException("start parameter out of range");		Document dest = docBuilder.newDocument();		Element root =			dest.createElementNS("http://exist.sourceforge.net/NS/exist", "exist:result");		root.setAttribute("xmlns:exist", "http://exist.sourceforge.net/NS/exist");		root.setAttribute("hitCount", Integer.toString(result.getLength()));		dest.appendChild(root);		Element temp;		Item item;		for (int i = start - 1; i < start + howmany - 1; i++) {			item = result.itemAt(i);			switch (item.getType()) {				case Type.NUMBER :					temp =						dest.createElementNS(							"http://exist.sourceforge.net/NS/exist",							"exist:number");					break;				case Type.STRING :					temp =						dest.createElementNS(							"http://exist.sourceforge.net/NS/exist",							"exist:string");					break;				case Type.BOOLEAN :					temp =						dest.createElementNS(							"http://exist.sourceforge.net/NS/exist",							"exist:boolean");					break;				default :					LOG.debug("unknown type: " + item.getType());					continue;			}			temp.appendChild(dest.createTextNode(item.getStringValue()));			root.appendChild(temp);		}		StringWriter sout = new StringWriter();		Properties props = new Properties();		props.setProperty(OutputKeys.INDENT, prettyPrint ? "yes" : "no");		props.setProperty(OutputKeys.ENCODING, "UTF-8");		DOMSerializer serializer = new DOMSerializer(sout, props);		try {			serializer.serialize(dest);		} catch (TransformerException ioe) {			LOG.warn(ioe);			throw ioe;		}		return sout.toString();	}