if (generateDocEvent)
{receiver.startDocument();}
if (doc.getDoctype() != null){
if ("yes".equals(getProperty(EXistOutputKeys.OUTPUT_DOCTYPE, "no"))) {
final StoredNode n = (StoredNode) doc.getDoctype();
serializeToReceiver(n, null, (DocumentImpl) n.getOwnerDocument(), true, null, new TreeSet<String>());
}
}
// iterate through children
for (int i = 0; i < children.getLength(); i++) {
final StoredNode node = (StoredNode) children.item(i);
final Iterator<StoredNode> domIter = broker.getNodeIterator(node);
domIter.next();
final NodeProxy p = new NodeProxy(node);
serializeToReceiver(node, domIter, (DocumentImpl)node.getOwnerDocument(),
true, p.getMatches(), new TreeSet<String>());
}
if (generateDocEvent) {receiver.endDocument();}