+ nodeType);
}
}
// w3cDOM -> DTM -> DOMImpl
DTMAxisIterator iter = null, childIter = null, attrIter = null;
if (doc != null) {
final MultiDOM multiDOM = (MultiDOM) dom;
DOM idom = (DOM)dtmManager.getDTM(new DOMSource(doc), false,
null, true, false);
// Create DOMAdapter and register with MultiDOM
DOMAdapter domAdapter = new DOMAdapter(idom,
translet.getNamesArray(),
translet.getUrisArray(),
translet.getTypesArray(),
translet.getNamespaceArray());
multiDOM.addDOMAdapter(domAdapter);
DTMAxisIterator iter1 = idom.getAxisIterator(Axis.CHILD);
DTMAxisIterator iter2 = idom.getAxisIterator(Axis.CHILD);
iter = new AbsoluteIterator(
new StepIterator(iter1, iter2));
iter.setStartNode(DTMDefaultBase.ROOTNODE);
childIter = idom.getAxisIterator(Axis.CHILD);
attrIter = idom.getAxisIterator(Axis.ATTRIBUTE);
}
// Second pass: find DTM handles for every node in the list.
int[] dtmHandles = new int[n];
n = 0;
for (int i = 0; i < nodeList.getLength(); ++i) {
if (proxyNodes[i] != DTM.NULL) {
dtmHandles[n++] = proxyNodes[i];
continue;
}
org.w3c.dom.Node node = nodeList.item(i);
DTMAxisIterator iter3 = null;
int nodeType = node.getNodeType();
switch (nodeType) {
case org.w3c.dom.Node.ELEMENT_NODE:
case org.w3c.dom.Node.TEXT_NODE:
case org.w3c.dom.Node.CDATA_SECTION_NODE:
case org.w3c.dom.Node.COMMENT_NODE:
case org.w3c.dom.Node.ENTITY_REFERENCE_NODE:
case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
iter3 = childIter;
break;
case org.w3c.dom.Node.ATTRIBUTE_NODE:
iter3 = attrIter;
break;
default:
// Should not happen, as first run should have got all these
throw new InternalRuntimeError("Mismatched cases");
}
if (iter3 != null) {
iter3.setStartNode(iter.next());
dtmHandles[n] = iter3.next();
// For now, play it self and perform extra checks:
if (dtmHandles[n] == DTMAxisIterator.END)
throw new InternalRuntimeError("Expected element missing at " + i);
if (iter3.next() != DTMAxisIterator.END)
throw new InternalRuntimeError("Too many elements at " + i);
++n;
}
}
if (n != dtmHandles.length)