Search in xml tags

I have a xml file like below. I want to search in <msg>, if found corresponding tag path needs to fetch.

for eg: for the message 'RM1659 Boeing Exception Management' it should return /trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip
For message it can have many paths.

Please give me a correct commands to find it.

<?xml version="1.0"?>
<log>
<logentry
   revision="428">
<date>2011-09-23T07:25:28.059356Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Transfer_SMRTVW_DBF.zip</path>
</paths>
<msg>Redmine : 613 FTP details moved to parameters table </msg>
</logentry>
<logentry
   revision="373">
<date>2011-08-26T12:36:11.583506Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip</path>
</paths>
<msg>RM1659 Boeing Exception Management</msg>
</logentry>
<logentry
   revision="372">
<date>2011-08-26T12:32:51.179995Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip</path>
</paths>
<msg>RM1659 Boeing Exception Management</msg>
</logentry>
<logentry
   revision="175">
<date>2011-06-21T10:44:43.849019Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Transfer_SMRTVW_DBF.zip</path>
</paths>
<msg>Redmine Issue 1233:
* Modified the JET for tSCPPut_main.javajet to re-raise the Java exception on SCP Put failure.
* Added a tDie step to abort if SCP file rename fails.  Checking for status "File rename OK" to detect success.</msg>
</logentry>
<logentry
   revision="52">
<date>2011-05-17T11:41:14.775777Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip</path>
</paths>
<msg>Added logging statements for file paths.</msg>
</logentry>
<logentry
   revision="47">
<date>2011-05-16T07:56:47.727376Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip</path>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Transfer_SMRTVW_DBF.zip</path>
</paths>
<msg>Fixing issues after the initial implementation of changes corresponding to
Redmine Issue 801 - Modified the file path in the Fetch File Names Component in DO_transfer_SMRTVW_DBF and DO_Smartview jobs.</msg>
</logentry>

By commands do you mean shell script or Perl script? I can recommend to do it in the latter, but if takes on a more structural form, you may want to look into XML databases such as sedna (Sedna XML Database).