in reply to Re: XML::Twig question
in thread XML::Twig question
That's what I'm really after plus the text between <Desc>???</Desc> starting from the just below the <AC> tag. The text between the <Desc>???</Desc> is quite important because that can be changed/amended
Also, is it possible to substitute "CCC" below with a variable e.g my $CCC = "CCC"
XML::Twig->new( twig_handlers => { 'AC@n=$CCC//AI' => sub { print $_->start_tag, "\n"; }->parsefile( "my.xml");
ID will always be direct children of AI
AI will always be direct children of AC
All of the above will always have a <Desc>???</Desc> below them describing what they're all about.
<World n="earth" > <Space n="XXX"> <CL n="XXX"> <Desc>CL desc</Desc> <Other/> <AC n="AAA" set="n"> <Desc>AC AAA desc</Desc> <AI n="AAA" set="n"> <Desc>AI AAA desc</Desc> <ID n="AAA" set="y"> <Desc>AAA ID desc</Desc> <What>What AAA ID </What> <AR>ID_aaa</AR> </ID> <ID n="BBB" set="y"> <Desc>BBB ID desc</Desc> <What>What BBB ID </What> <AR>ID_bbb</AR> </ID> </AI> <AI n="BBB" set="y"> <Desc>AI BBB desc</Desc> <ID n="AAA" set="y"> <Desc>AAA ID desc</Desc> <What>What AAA ID </What> <AR>ID_aaa</AR> </ID> </AI> </AC> <AC n="CCC" set="y"> <AI n="AAA" set="n"> <Desc>AI AAA desc</Desc> <ID n="AAA" set="y"> <Desc>AAA ID desc</Desc> <What>What AAA ID </What> <AR>ID_aaa</AR> </ID> </AI> <AI n="AAA" set="n"> <Desc>AI AAA desc</Desc> <ID n="AAA" set="y"> <Desc>AAA ID desc</Desc> <What>What AAA ID </What> <AR>ID_aaa</AR> </ID> </AI> </AC> </CL> </Space> </World>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: XML::Twig question
by mirod (Canon) on Dec 12, 2006 at 19:52 UTC | |
by Bizza (Initiate) on Dec 19, 2006 at 21:50 UTC | |
by mirod (Canon) on Dec 19, 2006 at 22:28 UTC | |
by thandi (Novice) on Dec 20, 2006 at 10:23 UTC | |
by mirod (Canon) on Dec 20, 2006 at 13:35 UTC | |
|