Visualize XML with Infinity
📊 Overview
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.
The following example, uses an XML response in Grafana:
<users>
<user age="20">
<name>User A</name>
</user>
<user age="21">
<name>User B</name>
</user>
</users>
If you want to get the user’s name and age from the preceding XML example, use the following syntax:
Rows/Root: users.user
to select all the user objects inside the user element.
Columns:
Column1 Name: Use name
as the selector for the property name
.
Column2 Age: Use $.age
as the selector for the attribute age
.
Example 2
Consider the below example:
<users>
<user age="20"> User A</user>
<user age="21">User B</user>
<user age="18">User C</user>
</users>
If you want to get the user’s name and age from the preceding XML example, use the following syntax:
Rows/Root: users.user
to select all the user objects inside user element.
Columns:
Column1 Name: Use _
as the selector for the property name
. Here _
refers to the text inside the node.
Column2 Age: Use $.age
as the selector for the attribute age
.
Example 3
Consider the following example:
<users>
<user>User A</user>
<user>User B</user>
<user>User C</user>
</users>
If you want to get the user’s name and age from the preceding XML example, use the following syntax:
Rows/Root: users.user
to select all the user objects inside user element
Columns:
Column1 Name: Use _
as the selector for the property name
. Here _
refers to the text inside the node
XML URL
You can also use the hosted XML via the URL. The following example shows how you connect XML using a GitHub gist.
The following image shows a sample example visualized using bar gauge panel and time series format: