Need to parse xml file and print element with checking an empty tag : <p>I need to write a perl script to parse through a XML file. If SpecialData tag has value, then I need to print the Name. I could write this 
for the following file.</p>

<p>For the following xml file, output should be Name-abc</p>

<pre><code>&lt;Data&gt;
    &lt;Name&gt;abc&lt;/Name&gt;
    &lt;SpecialData&gt;Properties&lt;/SpecialData&gt;
&lt;/Data&gt;

&lt;Data&gt;
    &lt;Name&gt;mnp&lt;/Name&gt;
&lt;/Data&gt;
</code></pre>

<p>But in a xml file as mentioned below, SpecialData tag has an empty tag Properties. I need to write a perl script that will print the name, if SpecialData tag is there. Here the difference is Properties is an inner tag, not a value as the 1st problem. Can anyone help me to write a perl script to do this?</p>

<p>For the following xml file, output should be Name- abc</p>

<pre><code>&lt;Data&gt;
    &lt;Name&gt;abc&lt;/Name&gt;
    &lt;SpecialData&gt;
      &lt;Properties /&gt;
    &lt;/SpecialData&gt;
&lt;/Data&gt;

&lt;Data&gt;
    &lt;Name&gt;mnp&lt;/Name&gt;
&lt;/Data&gt;
</code></pre>
