super.init(); if(StructKeyExists(arguments, 'src')) Load(arguments.src); return this; var pNodes = XPathResults(arguments.XPath); var cNodes = CreateNodes(arguments.value); var eNode = member.xmlDoc.GetDocumentElement().GetOwnerDocument().CreateElement(arguments.name); var aAttributes = StructKeyArray(arguments.attributes); var i = 0; var n = 0; if(not pNodes.GetLength() or not cNodes.GetLength()) return 0; // add value nodes to the new element node // NOTE: Strange behaviour here - The cNodes nodelist loses the node referenced on each AppendChild call // so a funky looking loop n = cNodes.GetLength(); for(i=1; i LTE n; i=i+1) eNode.AppendChild(cNodes.item(0)); // add attributes for(i=1; i LTE ArrayLen(aAttributes); i=i+1) eNode.SetAttribute(aAttributes[i], arguments.attributes[aAttributes[i]]); // add new element node to all the parent nodes found in the XPath for(i=0; i LT pNodes.GetLength(); i=i+1) pNodes.item(javacast('int',i)).AppendChild(eNode.CloneNode(true)); return pNodes.GetLength(); var pNodes = XPathResults(arguments.XPath); var i = 0; if(not pNodes.GetLength()) return 0; try{ for(i=0; i LT pNodes.GetLength(); i=i+1) pNodes.item(javacast('int',i)).SetAttribute(arguments.name, arguments.value); }catch(any e){ return i; } return pNodes.GetLength(); var pNodes = XPathResults(arguments.XPath); // parent nodes var cNodes = CreateNodes(arguments.value); // child nodes var i = 0; var n = 0; // if results contain document, return with error if(NodeListContainsTypes(pNodes,9)) return 0; // delete any child nodes from the result elements Delete('#arguments.XPath#/*|#arguments.XPath#/text()|#arguments.XPath#/comment()|#arguments.XPath#/processing-instruction()'); // loop through the nodes who's data is to be replaced for(i=0; i LT pNodes.GetLength(); i=i+1) { // do different things dependant on the type of node switch(NodeTypeAsString(pNodes.item(javacast('int',i)).GetNodeType())) { // simple nodes, just set their values case 'Attribute': case 'Text': case 'Processing Instruction': case 'comment': case 'CDATA': { if(IsSimpleValue(arguments.value)) pNodes.item(javacast('int',i)).SetNodeValue(arguments.value); break; } // elements and docs, append child nodes case 'Element': { for(n=0; n LT cNodes.GetLength(); n=n+1) pNodes.item(javacast('int',i)).AppendChild(cNodes.Item(javacast('int',n)).CloneNode(true)); } } } return pNodes.GetLength(); var nodes = XPathResults(arguments.XPath); var i = 0; for(i=0; i LT nodes.GetLength(); i=i+1) { try{ switch(NodeTypeAsString(nodes.item(javacast('int',i)).GetNodeType())) { // attribute case 'Attribute':{ nodes.item(javacast('int',i)).getOwnerElement().RemoveAttribute(nodes.item(javacast('int',i)).GetNodeName()); break; } // the document (delete all the xml) case 'Document':{ member.xmlDoc = XmlNew(); return nodes.GetLength(); break; } // other nodes: use getparent->deletechild case 'Element': case 'Text': case 'Comment': case 'Processing Instruction':{ nodes.item(javacast('int',i)).GetParentNode().RemoveChild(nodes.item(javacast('int',i))); break; } // default: not supported default:{ Throw("Error deleting xml.", "The type of nodes returned by the XPath expression, #arguments.XPath#, are not supported by this method at this time.", 104, "BetterXml"); return i-1; } } }catch(any e){ return i-1; } } return nodes.GetLength(); var aKeys = ""; var tempNode = member.xmlDoc.GetDocumentElement().GetOwnerDocument().CreateElement("temp"); var newNode = ""; var subNodes = ""; var i = 0; var n = 0; var x = 0; var size = 0; if(IsSimpleValue(arguments.value)){ try{ newNode = XmlParse('' & arguments.value & '').GetDocumentElement().GetFirstChild(); AppendNode(tempNode, newNode); } catch(any e){ tempNode.AppendChild(member.xmlDoc.GetDocumentElement().GetOwnerDocument().CreateTextNode(arguments.value)); } } else if(IsStruct(arguments.value)) { keys = StructKeyArray(arguments.value); size = ArrayLen(keys); for(i=1; i LTE size; i=i+1) { newNode = tempNode.AppendChild(member.xmlDoc.GetDocumentElement().GetOwnerDocument().CreateElement(LCase(keys[i]))); subNodes = CreateNodes(arguments.value[keys[i]]); x = subNodes.GetLength(); for(n=0; n LT x; n=n+1) newNode.AppendChild(subNodes.item(0)); } } else Throw("Only structures and strings can be used to insert or update elements.", "", 105, "BetterXml"); return tempNode.GetChildNodes(); var cNodes = arguments.nodeB.GetChildNodes(); var cNode = ""; var i = 0; var n = cNodes.getLength(); for(i=0; i LT cNodes.getLength(); i=i+1){ cNode = cNodes.item(JavaCast("int", i)); cNode = arguments.nodeA.GetOwnerDocument().ImportNode(cNode,JavaCast( "boolean", true )); arguments.nodeA.AppendChild(cNode); } return arguments.nodeA;