NodeImpl node = (NodeImpl) v;
if (node.getDocument() == doc) {
node = expandedDoc.getNode(node.getNodeNumber());
NodeId nodeId = node.getNodeId();
if (nodeId == null)
{throw new XPathException("Internal error: nodeId == null");}
if (node.getNodeType() == Node.DOCUMENT_NODE)
{nodeId = rootId;}
else
{nodeId = rootId.append(nodeId);}
NodeProxy p = new NodeProxy(newDoc, nodeId, node.getNodeType());
if (p != null) {
// replace the node by the NodeProxy
items[j].item = p;
}
}
}
}
}
set.add((NodeProxy) items[i].item);
} else {
set.add((NodeProxy)v);
}
}
}
return set;
} else
{throw new XPathException("Type error: the sequence cannot be converted into" +
" a node set. Item type is " + Type.getTypeName(itemType));}
}