XML.DeletePath
--------------

Delete a xml node.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [XML](component_XML.md) | [7.4](newinversion74.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "XML.DeletePath"; XML; Path { ; Flags } ) 

**MBS**( **"XML.DeletePath";** /\* Delete a xml node. \*/  
**$XML**; /\* The XML to process.  
Can be XML as text or the reference returned by [XML.Parse](XMLParse.md) function.  
If you pass the reference number so you can make several times changes to the XML without parsing and xml output it each time.e.g. "&lt;test&gt;Hello&lt;/test&gt;" \*/   
**$Path**; /\* The path to the node or attribute to query.e.g. "name" \*/   
**$Flags**) /\* Optional; Various Flags.  
Add 1 to ignore errors in xml and continue parsing. This may lead to not everything in the xml being read.  
Add 4 to format returned XML.  
Add 32 to return result as XML.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| XML | The XML to process.   Can be XML as text or the reference returned by [XML.Parse](XMLParse.md) function.   If you pass the reference number so you can make several times changes to the XML without parsing and xml output it each time. | "&lt;test&gt;Hello&lt;/test&gt;" |  |
| Path | The path to the node or attribute to query. | "name" |  |
| Flags | Various Flags.   Add 1 to ignore errors in xml and continue parsing. This may lead to not everything in the xml being read.   Add 4 to format returned XML.   Add 32 to return result as XML. | 0 | Optional |

### Result

Returns OK or error.

### Description

Delete a xml node.  
This function uses a path notation like the [JSON](component_JSON.md) functions in FileMaker to describe paths.  
You can use name of a node followed by option index in square brackets. On the end you can use # followed by a name of an attribute to select only the attribute.  
Delimiter between items can be dot like FileMaker or newline.  
  
If you pass in a XML reference number and you do not pass Flag value 32 for returning as XML, we just modify the XML reference in memory. This avoids performance hit for outputting and parsing xml for each change.  
### Examples

Delete node:

 MBS ( "XML.DeletePath"; "&lt;test&gt;&lt;node&gt;Hello&lt;/node&gt;&lt;/test&gt;"; "test.node"; 0)  
<small>  
Example result:   
&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
&lt;test/&gt;</small>Delete attribute:

 MBS ( "XML.DeletePath"; "&lt;test&gt;&lt;node id=\\"123\\"&gt;Hello&lt;/node&gt;&lt;/test&gt;"; "test.node#id"; 0)  
<small>  
Example result:   
&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
&lt;test&gt;&lt;node&gt;Hello&lt;/node&gt;&lt;/test&gt;</small>### See also

- [XML.Parse](XMLParse.md)

### Release notes

- **Version 7.4**
    - Added [XML.GetPathValue](http://www.mbsplugins.eu/XMLGetPathValue.shtml), [XML.DeletePath](http://www.mbsplugins.eu/XMLDeletePath.shtml) and [XML.SetPathValue](http://www.mbsplugins.eu/XMLSetPathValue.shtml) functions.

### Blog Entries

- [MBS FileMaker Plugin, version 7.4pr6](https://www.mbsplugins.de/archive/2017-09-17/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 3/2025, Seite 22](https://filemaker-magazin.de/neuigkeit/4290-Appetithappen-FMM_202503)

This function checks for a license.

Created 16th September 2017 , last changed 13th March 2023

  
[XML.Compact](XMLCompact.md) - [XML.ExtractText](XMLExtractText.md)

[HTML Version](XMLDeletePath.shtml)