attrs.addAttribute("", "created", "created", "CDATA", dateFormat.format(new Date(childCollection .getCreationTime())));
    protected String printCollection(DBBroker broker, Collection collection) {        SAXSerializer serializer = null;        StringWriter writer = new StringWriter();        try {            serializer = (SAXSerializer) SerializerPool.getInstance().borrowObject(SAXSerializer.class);                        serializer.setOutput(writer, defaultProperties);            AttributesImpl attrs = new AttributesImpl();                        serializer.startDocument();            serializer.startPrefixMapping("exist", NS);            serializer.startElement(NS, "result", "exist:result", attrs);                        attrs.addAttribute("", "name", "name", "CDATA", collection                    .getURI().toString());            printPermissions(attrs, collection.getPermissions());                        serializer                    .startElement(NS, "collection", "exist:collection", attrs);                        for (Iterator i = collection.collectionIterator(); i.hasNext();) {                XmldbURI child = (XmldbURI) i.next();                 Collection childCollection = broker.getCollection(collection.getURI().append(child));                if (childCollection!=null && childCollection.getPermissions().validate(broker.getUser(),                        Permission.READ)) {                    attrs.clear();                    attrs.addAttribute("", "name", "name", "CDATA", child.toString());                                        attrs.addAttribute("", "created", "created", "CDATA",                            dateFormat.format(new Date(childCollection                            .getCreationTime())));                    printPermissions(attrs, childCollection.getPermissions());                    serializer.startElement(NS, "collection",                            "exist:collection", attrs);                    serializer.endElement(NS, "collection", "exist:collection");                }            }                        for (Iterator i = collection.iterator(broker); i.hasNext();) {                DocumentImpl doc = (DocumentImpl) i.next();                if (doc.getPermissions().validate(broker.getUser(),                        Permission.READ)) {                    XmldbURI resource = doc.getFileURI();                    DocumentMetadata metadata = doc.getMetadata();                    attrs.clear();                    attrs.addAttribute("", "name", "name", "CDATA", resource.toString());                    attrs.addAttribute("", "created", "created", "CDATA",                            dateFormat.format(new Date(metadata.getCreated())));                    attrs.addAttribute("", "last-modified", "last-modified",                            "CDATA", dateFormat.format(new Date(metadata.getLastModified())));                    printPermissions(attrs, doc.getPermissions());                    serializer.startElement(NS, "resource", "exist:resource",                            attrs);                    serializer.endElement(NS, "resource", "exist:resource");                }            }                        serializer.endElement(NS, "collection", "exist:collection");            serializer.endElement(NS, "result", "exist:result");                        serializer.endDocument();        } catch (SAXException e) {            // should never happen            LOG.warn("Error while serializing collection contents: "                    + e.getMessage(), e);        } finally {            SerializerPool.getInstance().returnObject(serializer);        }        return writer.toString();    }