Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
<Class ID="E12.Production"> <comment> This class comprises activities that are designed to, and succeed in, +creating one or more new items. It specializes the notion of modification into production. The decisio +n as to whether or not an object is regarded as new is context sensit +ive. Normally, it This entity can be collective: the printing of a thousand books, for e +xample, would normally be considered a single event. An event should also be documented using E81 Transformation if it resu +lts in the destruction of one or more objects and the simultaneous pr +oduction of other </comment> <subClassOf resource="#E11.Modification"/> <subClassOf resource="#E63.Beginning_of_Existence"/> </Class>
My perl code
my $twig = XML::Twig->new( twig_handlers => { Class => \&offer } ); $twig->parsefile('class.xml'); sub offer { my( $t, $offer)= @_; if ($offer->first_child('subClassOf')) { print"is subclass of" .$offer->first_child('subClassOf')->att('resourc +e') } $t->purge; }
My question
How do I get a var set to the second value in the xml treeThanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML twig question
by Tanktalus (Canon) on Mar 01, 2006 at 04:00 UTC | |
|
Re: XML twig question
by runrig (Abbot) on Mar 01, 2006 at 01:59 UTC | |
|
Re: XML twig question
by diotalevi (Canon) on Mar 01, 2006 at 01:46 UTC | |
by Anonymous Monk on Mar 01, 2006 at 01:55 UTC |