public NodePointer createChild(JXPathContext context, QName name, int index){
Object collection = createCollection(context, index);
if (!isActual() || (index != 0 && index != WHOLE_COLLECTION)){
AbstractFactory factory = getAbstractFactory(context);
// Ignore the name passed as a parameter, pass the name of the variable instead
if (!factory.createObject(context, this, collection, getName().toString(), index)){
throw new JXPathException("Factory could not create object path: " + asPath());
}
setIndex(index);
}
return this;