in reply to Extracting specific childnodes

Thanks in advance.-

Hi madbee r:)

I already gave this answer in Re: Counting number of child nodes based on element value (typos)/Re: Having trouble with siblings/Re: Get Node Value from irregular XML (xpather.pl) but here you go

my $xpath_Include_LI_Title = q{ //Article/Main/Sect/*[ ( name()="H3" or name()="H4" ) and contains(.,"Include" ) ]//LI_Title };

If you only want the LI_Title instead of the LI, just copy/paste that tagname :)

xpath is quite fond of whitespace, so merely because cmd.exe doesn't seem to like it, no reason for you to avoid it

Replies are listed 'Best First'.
Re^2: Extracting specific childnodes (xpath whitespace)
by madbee (Acolyte) on Jul 06, 2013 at 04:13 UTC

    Hello @Anonymous Monk! Thanks for responding. Tried your approach. It didn't return anything.

    @nodes=$dom->findnodes($xpath_Include_LI_Title); print "{@nodes}\n";

    the nodes array should contain the values of LI_Title elements, correct?

    Thanks again!

      Well, I made a typo of omission . I didn't make the same typo one of the linked nodes. Can you figure out what it is? What is the first step to figure it out?

      Can you explain in english the xpath I provided in untypo'd node?

      :)

        Dude! Thanks much. Weekend where I am-so didnt get on it until now.In your earlier post, the typo or should I say omission was the full path to LI_Title. Adding that fixed my problem and filled the array.

        Thank you for taking the time to run the code and explain. Really appreciate it..As you can tell, newbie to both Perl and Xpath and learning on the fly.

        Regards,Madbee