OutputFormat format = new OutputFormat("xml", encoding, prettyPrint);
OutputFormat format = new OutputFormat("xml", "UTF-8", prettyPrint);
	protected String printValues(		ValueSet resultSet,		int howmany,		int start,		boolean prettyPrint,		String encoding)		throws Exception {		if (resultSet.getLength() == 0)			return "<?xml version=\"1.0\" encoding=\""				+ encoding				+ "\"?>\n"				+ "<exist:result xmlns:exist=\"http://exist.sourceforge.net/NS/exist\" "				+ "hitCount=\"0\"/>";		if (howmany > resultSet.getLength() || howmany == 0)			howmany = resultSet.getLength();		if (start < 1 || start > resultSet.getLength())			throw new EXistException("start parameter out of range");		Value value;		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(resultSet.getLength()));		dest.appendChild(root);		Element temp;		for (int i = start - 1; i < start + howmany - 1; i++) {			value = resultSet.get(i);			switch (value.getType()) {				case Value.isNumber :					temp =						dest.createElementNS(							"http://exist.sourceforge.net/NS/exist",							"exist:number");					break;				case Value.isString :					temp =						dest.createElementNS(							"http://exist.sourceforge.net/NS/exist",							"exist:string");					break;				case Value.isBoolean :					temp =						dest.createElementNS(							"http://exist.sourceforge.net/NS/exist",							"exist:boolean");					break;				default :					LOG.debug("unknown type: " + value.getType());					continue;			}			temp.appendChild(dest.createTextNode(value.getStringValue()));			root.appendChild(temp);		}		StringWriter sout = new StringWriter();		OutputFormat format = new OutputFormat("xml", encoding, prettyPrint);		format.setOmitXMLDeclaration(false);		format.setOmitComments(false);		format.setLineWidth(60);		XMLSerializer xmlout = new XMLSerializer(sout, format);		try {			xmlout.serialize(dest);		} catch (IOException ioe) {			LOG.warn(ioe);			throw ioe;		}		return sout.toString();	}