// System.out.println(value);
DTMIterator nl = value.iter();
// Copy the tree.
DTMTreeWalker tw = new TreeWalker2Result(transformer, handler);
int pos;
while (DTM.NULL != (pos = nl.nextNode()))
{
DTM dtm = xctxt.getDTMManager().getDTM(pos);
short t = dtm.getNodeType(pos);
// If we just copy the whole document, a startDoc and endDoc get
// generated, so we need to only walk the child nodes.
if (t == DTM.DOCUMENT_NODE)
{
for (int child = dtm.getFirstChild(pos); child != DTM.NULL;
child = dtm.getNextSibling(child))
{
tw.traverse(child);
}
}
else if (t == DTM.ATTRIBUTE_NODE)
{
SerializerUtils.addAttribute(handler, pos);
}
else
{
tw.traverse(pos);
}
}
// nl.detach();
break;
case XObject.CLASS_RTREEFRAG :