}
Node existingElement;
NamespaceResolver namespaceResolver = getNamespaceResolverForField(xmlField);
for (int i = 1; i < index; i++) {
Field field = new XMLField(element + "[" + i + "]");
field.setNamespaceResolver(namespaceResolver);
existingElement = (Node)unmarshalXPathEngine.selectSingleNode(parent, field, namespaceResolver);
if (existingElement == null) {
addElement(new XPathFragment(element), xmlField, parent, this, true, session);
}
}
Field field = new XMLField(fragment.getXPath());
field.setNamespaceResolver(namespaceResolver);
existingElement = (Node)unmarshalXPathEngine.selectSingleNode(parent, field, namespaceResolver);
if (existingElement == null) {
return addElement(new XPathFragment(element), field, parent, value, true, session);
}