How to search the JIRA XML backup with XPath
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This article shows some of the ways a JIRA XML backup can be easily searched using XPath (basically SQL for XML).
Solution
In this example we're going to search for a specific label in JIRA. This is stored under the Label
entity in the XML file. Some sample data is below, and this KB is written using Linux command line with a tool called xmllint. There may be other tools for Windows that can be used instead of xmllint.
1
2
3
4
<Label id="10000" issue="11347" label="agatha_christie"/>
<Label id="10001" issue="11347" label="you're"/>
<Label id="10002" issue="11347" label="my"/>
<Label id="10003" issue="11347" label="hero"/>
Unzip the compressed backup ZIP with your favourite unarchive tool.
Use xmllint to search the file using the XPath. In this example we're searching for the 'hero' label in JIRA.
1
xmllint --xpath '//Label[@label="hero"]' entities.xml ⏎
ℹ️ This searches for the XML 'Label', with the name 'hero'.
This returns the below results:
1
<Label id="10003" issue="11347" label="hero"/>
And there we have it! Using xmllint you can search for specific XML criteria with a Linux command-line. If you wish to search for other things the XPath search criteria can be changed as per step 2.
Was this helpful?