This may be of help:
function removeXMLNode(strNodeName){
// XML nodes within 2nd indendation and below cannot be removed (Bug?), exception is thrown.
// Thus use try/catch.
try {
var objNode = xfa.record[strNodeName];
if (objNode){
xfa.record.nodes.remove(objNode);
}
}catch(e){
console.println("removing XML node named '"+ strNodeName +"' failed.");
}
}
You may call this method using something like
removeXMLNode("Subform1")
prior to the form being submitted.
I could not get this to work with nodes deeper than a single level, ie.
form1.Subform1.SubSubform1
cannot be removed. I suppose, it's a bug.