|XP is just a number|
Having trouble with siblingsby madbee (Acolyte)
|on Jun 30, 2013 at 08:22 UTC||Need Help??|
madbee has asked for the
wisdom of the Perl Monks concerning the following question:
Hello! Still trying to parse the same XML as before - but now having trouble with siblings. I have 2 versions of the xml file. Need to come up with a generic script to extract the values in either cases. Pasting the XML first and then my attempt.
When I run my script, it doesnt return any siblings. just 1.
Objective:In this scenario, I need to search for Purpose and rationale. If found, need to extract all siblings between <header> and </header>
The same section Purpose and rationale can exist in another xml but in different format. The challenge is to have 1 generic script to handle both scenarios.
XML Scenario 2:
For scenario 2, I need to extract all the siblings under Purpose and rationale only until "Some other heading". This heading title can change. The only identifier is that the node begins with a number.
In this xml content from 2 headers is mixed up. so i only need to extract the content from the siblings of the "purpose and rationale" section
My attempted code is below:
This only returns the value within the header tags and none of the children. obviously,i'm doing something wrong.Hoping for some help here to extract the content I need.
Thanks again for your help and apologies if the question is not clear