Chas. Owens wrote:



Perhaps I am dense, but what is the desired output from the given XML?

Hello Chas,

From xml file, based on attribute value for bayking id, I want to find kingtony and then I want to traverse back up to yahoo and print everything from
<yahoo> to </yahoo>

I have tried to use xpath //../../bayking but doesn't seem to work.

I am trying to ultimately push below find value into hash of hash reference such as

<yahoo V="baz">  $list{'yahoo'} = { 'V' => 'baz'}

<bayking id="kingtony" country="Russia" active="true"> $list{'bayking'} = { 'id' => 'kingtony' , 'country' => 'Russia', 'active' => 'true' }

I am able to find what I am looking for 'kingtony' but having tough time traversing back to right yahoo element and accessing all data.


    <yahoo V="baz">
        <bay_id>
            <value>1000</value>
            <fact>yes</fact>
        </bay_id>
        <bay_seen>
            <value>50</value>
            <fact>no</fact>
        </bay_seen>
        <bay_overall value="disabled"/>
        <bayking_list>
            <bayking id="kingtony" country="Russia" active="true">
                <bayking type="dictator"/>
                <bay_usage value="none"/>
                <bayking_origin>
<bayking_origin_name value="ohio_usa" emmigrate="no">
                             <economy_status_previous value="very poor" />
                      </bayking_origin_name>
                </bayking_origin>
            </bayking>
        </bayking_list>

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to