SAXSerializer serializer = new SAXSerializer(out, new Properties());
Properties props = new Properties(); props.setProperty(OutputKeys.INDENT, "yes"); SAXSerializer serializer = new SAXSerializer(out, props);
    public void testXQuery() throws Exception {        BrokerPool pool = BrokerPool.getInstance();        DBBroker broker = null;        try {            broker = pool.get(SecurityManager.SYSTEM_USER);            XQuery xquery = broker.getXQueryService();            Sequence result = xquery.execute(XQUERY, null);            System.out.println("Found: " + result.getLength());            StringWriter out = new StringWriter();            SAXSerializer serializer = new SAXSerializer(out, new Properties());            serializer.startDocument();            for (SequenceIterator i = result.iterate(); i.hasNext(); ) {                Item next = i.nextItem();                next.toSAX(broker, serializer);            }            serializer.endDocument();            System.out.println(out.toString());        } finally {            pool.release(broker);        }    }