> For the complete documentation index, see [llms.txt](https://daseldocs.tomwright.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daseldocs.tomwright.me/v1/examples/xml.md).

# XML

XML has some slight differences (such as attributes) that should be documented.

See [XML file format](/v1/usage/supported-file-types.md#xml) for more information.

## **Query attributes**

Decoded attributes are set as properties on the related object with a prefix of `-`.

```shell
echo '<data>
    <users primary="true">
        <name>Tom</name>
    </users>
    <users primary="false">
        <name>Frank</name>
    </users>
</data>' | dasel -p xml '.data.users.[0].-primary'
true
```

## **Filtering on attributes**

We can also filter on attributes since they are defined against the related object.

```shell
echo '<data>
    <users primary="true">
        <name>Tom</name>
    </users>
    <users primary="false">
        <name>Frank</name>
    </users>
</data>' | dasel -p xml '.data.users.(-primary=true).name'
Tom
```
