tree.addPI(child.getNodeName().getLocalName(), child.getStringValue());
} else if (child.getNodeKind() == XdmNodeKind.TEXT) {
tree.addText(child.getStringValue());
} else {
tree.addStartElement(child);
tree.addAttributes(child);
tree.startContent();
// Serialize the *whole* thing, then strip off the start and end tags, because
// otherwise namespace fixup messes with the namespace bindings
ByteArrayOutputStream outstr = new ByteArrayOutputStream();