XML.HasAttribute
----------------

Queries whether an attribute exists.

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

MBS( "XML.HasAttribute"; XML; Name { ; Flags } ) 

**MBS**( **"XML.HasAttribute";** /\* Queries whether an attribute exists. \*/  
**$XML**; /\* The XML to process.  
Can be XML as text or the reference returned by [XML.Parse](XMLParse.md) function, so you can make several times changes to the XML without parsing it each time.e.g. "&lt;test&gt;Hello&lt;/test&gt;" \*/   
**$Name**; /\* The name of the 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.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, so you can make several times changes to the XML without parsing it each time. | "&lt;test&gt;Hello&lt;/test&gt;" |  |
| Name | The name of the 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. | 0 | Optional |

### Result

Returns 1, 0 or error.

### Description

Queries whether an attribute exists.  
### Examples

Queries whether attribute exists:

 MBS ( "XML.HasAttribute"; "&lt;a href=\\"http://mbsplugins.de\\"&gt;mbsplugins.de&lt;/a&gt;"; "href")  
<small>  
Example result: 1</small>### See also

- [XML.GetAttribute](XMLGetAttribute.md)
- [XML.ListAttributes](XMLListAttributes.md)
- [XML.Parse](XMLParse.md)

### Release notes

- **Version 7.0**
    - Added XML helper functions: [XML.ExtractText](http://www.mbsplugins.eu/XMLExtractText.shtml), [XML.NodeNames](http://www.mbsplugins.eu/XMLNodeNames.shtml), [XML.SetVariables](http://www.mbsplugins.eu/XMLSetVariables.shtml), [XML.ListAttributes](http://www.mbsplugins.eu/XMLListAttributes.shtml), XML.HasAttributes, XML.GetAttributes and [XML.SubTree](http://www.mbsplugins.eu/XMLSubTree.shtml).

### FileMaker Magazin

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

This function checks for a license.

Created 27th December 2016 , last changed 2nd February 2018

  
[XML.GetSaveNoEmptyTags](XMLGetSaveNoEmptyTags.md) - [XML.Import](XMLImport.md)

[HTML Version](XMLHasAttribute.shtml)