switch (((NodeInfo)next).getNodeKind()) {
case Type.DOCUMENT:
tree.startElement(resultDocument, -1, 0, 0);
tree.startContent();
((DocumentInfo)next).copy(tree, NodeInfo.ALL_NAMESPACES, true, 0);
tree.endElement();
break;
case Type.ELEMENT:
tree.startElement(resultElement, -1, 0, 0);
tree.startContent();
((NodeInfo)next).copy(tree, NodeInfo.ALL_NAMESPACES, true, 0);