in reply to Re: Pasing an XML file to generate a certain output.
in thread Pasing an XML file to generate a certain output.
#!/usr/bin/perl use XML::Twig; # at most one div will be loaded in memory my $twig=XML::Twig->new( twig_handlers => { channel => sub { my( $node )= @_; my( $id )= $node->{'att'}->{id}; my( $chan )= $node->{'att'}->{chan}; my( $sign )= $node->text; print qq(UPDATE channel SET channum="$chan",xmltvid="$id" WHER +E callsign="$sign"); $node->purge; }, }, ); $twig->parse(<DATA>); __DATA__ <channel id="6945.dvb.guide" <!-- number="84" type="0x19" flags="0xf" +bouquet="4110" region="2000000e" sid="6945" --> > <display-name>6945</display-name> </channel>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Pasing an XML file to generate a certain output.
by Anonymous Monk on May 13, 2015 at 10:56 UTC | |
by Discipulus (Canon) on May 13, 2015 at 10:58 UTC | |
by Saner (Novice) on May 13, 2015 at 11:54 UTC | |
by choroba (Cardinal) on May 13, 2015 at 12:44 UTC |