How to search the JIRA XML backup with XPath

Still need help?

The Atlassian Community is here for you.

Ask the community

Purpose

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.

    <Label id="10000" issue="11347" label="agatha_christie"/>
    <Label id="10001" issue="11347" label="you&apos;re"/>
    <Label id="10002" issue="11347" label="my"/>
    <Label id="10003" issue="11347" label="hero"/>
  1. Unzip the compressed backup ZIP with your favourite unarchive tool.
  2. Use xmllint to search the file using the XPath. In this example we're searching for the 'hero' label in JIRA.

    xmllint --xpath '//Label[@label="hero"]' entities.xml                                                                      ⏎

    (info) This searches for the XML  'Label', with the name 'hero'.

  3. This returns the below results:

    <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.

Last modified on May 15, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.