Element domElement = uaElement.element;
UAElement parent = uaElement.getParentElement();
for (int i=0;i<nodes.length;++i) {
if (nodes[i].getNodeType() == Node.ELEMENT_NODE) {
// ensure elements are typed
parent.insertBefore(UAElementFactory.newElement((Element)nodes[i]), uaElement);
}
else {
// text nodes are not typed
Node node = domElement.getOwnerDocument().importNode(nodes[i], true);
parent.element.insertBefore(node, domElement);