The task is as below:
XML file:
<article>
<section>
<number>1</number>
<issue></issue>
<year></year>
<b></b>
</section>
<chapter>
<p>hai this is sample<b>for u</b><i></i><sup></sup>
</p>
</chapter>
</article>
Now the task is i need to write a perl script to find and throw the error list of empty tags that is present in between <chapter> and </chapter>, i dont wan to highlight the error which is in between <section> and </section>.
I had developed a script as belw but it is highlighting all the empty tags even from <section> area.
The code is as below:
$cnt=1;
while($content=~/<(sup¦inf¦i¦b)><\/\1>/ig)
{
print outfile "Error ".$cnt."Empty Tag <". $1 . "> Found"."\n";
$cnt++;
}
can any one help in this regard?
first use a regular expression to extract the contents of the chapter tag and put the string into the $content variable.
then use your code snippet to report the empty tags.