Open source Enterprise Grafana Cloud

XML

Select XML as the query type to retrieve data from XML APIs or files. You can query data from a URL or provide inline XML data.

Give it a try using Grafana Play
Give it a try using Grafana Play

With Grafana Play, you can explore and see how it works, learning from practical examples to accelerate your development. This feature can be seen on Infinity plugin XML demo.

Selector syntax

XML selectors use dot notation to navigate the document structure. Special syntax is available for attributes and text content.

SelectorDescription
element.childSelect child elements
$.attributeSelect an attribute (prefix with $)
_Select the text content of an element

Example: Elements with child nodes and attributes

XML data:

xml
<users>
    <user age="20">
        <name>User A</name>
    </user>
    <user age="21">
        <name>User B</name>
    </user>
</users>

Configuration:

SettingJSONata parserJQ parser
Root selector$.users.user.users.user
Column selectorTitleDescription
nameNameSelects the <name> child element
-ageAgeSelects the age attribute