sachin6444 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Folks, I am new to perl and need help. I have XML file and I want to iterate and look for follow items. For example I should look for Home=50 and under home, there are 1bedroom=2, 2bedroom=3 , 3bedroom=4. In the XML code there are more than thousands of home, I am looking for home which has all three(1bedroom,2bedroom and 3bedroom)no values, Can anybody explain with code will be helpful

Replies are listed 'Best First'.
Re: XML Parsing using perl
by toolic (Bishop) on Feb 21, 2014 at 02:34 UTC
Re: XML Parsing using perl
by Discipulus (Canon) on Feb 21, 2014 at 08:00 UTC
Re: XML Parsing using perl
by locked_user sundialsvc4 (Abbot) on Feb 21, 2014 at 15:17 UTC

    Whereas I would have suggested XML::LibXML, because this gives you direct access to what, I believe, is the industry-standard library for dealing with XML.   In particular, it gives you access to XSLT, and it is positively goofy what you can do with that technology, without writing a single line of “programming” at all.   For instance, consider the famous Interactive Periodic Table of the Elements web site, which is entirely formatted by your browser, on your browser, without using any JavaScript to do or to control the formatting.   You can use XSLT to “query” your data-source to answer questions just like the one you posed.   Heck, you can even do it within a capable spreadsheet:   there are lots of clients of libxml.so.

      Writing XSLT IS programming, just like writing SQL or Prolog or Haskel is. You don't need to have to write

      step 1. do this
      step 2. do that
      step 3. while something is true repeat step 4.
      step 4. do whatever
      step 5. blah blah
      
      to be programming!

      And that page ... without JavaScript? Really? Did you look at the sources? <script type="text/javascript" language="javascript" src="tooltip/script.js"></script> is what?

      If you are used to "the industry standard" ... that is to something designed for the lowest common denominator of programming languages still in use today ... by all means go with XML::LibXML.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

      Yeah… turn off JS and that periodic table page does not load any content whatsoever, and it has 24 script tags.