Skip to main content

Delete nodes

Remove every element (or one attribute of each) that a path such as //order/note finds, in a file, in XML text or in a session.

Command in the XML toolkit · id ooa.xml/delete_nodes · 7 inputs (1 required), 2 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
PathFileNoXML file (or use xml).
XPathStringYesXPath of the nodes to remove.
Save toFileNoSave to another file instead of overwriting.
AttributeStringNoRemove only this attribute from the matched elements, keeping the elements.
XMLStringNoXML text to change instead of a file; the result is in the xml output.
NamespacesDictionaryNoPrefix to namespace URI for prefixes in the XPath, e.g. {"inv": "urn:example:invoice"}; prefixes declared in the document work without this. Map a default namespace (xmlns="...") to a prefix of your choice to address it; a prefix with an empty URI, e.g. {"d": ""}, stands for the document's own default namespace.
SessionStringNoWork on the XML of this session (Start session) instead of a file or text; changes stay in the session until End session saves them.

Outputs​

OutputTypeWhat it is
countNumberNodes (or attributes) removed.
xmlStringThe XML after the change.