* @return the new <CODE>Node</CODE> of the inserted name
*/
public Node insertNode(Node n, String shortName) {
Stack2 stack = splitParts(shortName);
org.w3c.dom.Document doc = n.getOwnerDocument();
Node n2 = null;
n = n.getFirstChild();
for (int k = 0; k < stack.size(); ++k) {
String part = (String)stack.get(k);
int idx = part.lastIndexOf('[');
String name = part.substring(0, idx);
idx = Integer.parseInt(part.substring(idx + 1, part.length() - 1));
int found = -1;
for (n2 = n.getFirstChild(); n2 != null; n2 = n2.getNextSibling()) {
if (n2.getNodeType() == Node.ELEMENT_NODE) {
String s = escapeSom(n2.getLocalName());
if (s.equals(name)) {
++found;
if (found == idx)
break;
}
}
}
for (; found < idx; ++found) {
n2 = doc.createElementNS(null, name);
n2 = n.appendChild(n2);
Node attr = doc.createAttributeNS(XFA_DATA_SCHEMA, "dataNode");
attr.setNodeValue("dataGroup");
n2.getAttributes().setNamedItemNS(attr);
}
n = n2;
}
inverseSearchAdd(inverseSearch, stack, shortName);