Hello,
I've search in the perl forum the script who talk about xml:
arser and i've found one interesting :
[URL unfurl="true"]http://www.tek-tips.com/viewthread.cfm?qid=1161992
[/url]
i've taken the script and modify it for my xml file
my xml file
when i launch the script i've nothing ???
normally i must have this result
why i've not this ???
thanks
I've search in the perl forum the script who talk about xml:
[URL unfurl="true"]http://www.tek-tips.com/viewthread.cfm?qid=1161992
[/url]
i've taken the script and modify it for my xml file
Code:
#!/usr/bin/perl -w
use strict;
use XML::Parser;
my $parser = XML::Parser->new( Handlers => {
Start => \&handle_elem_start,
});
my $file = 'instance.xml';
$parser->parsefile($file);
sub handle_elem_start {
my ($expat, $name, %atts) = @_;
if ( uc($name) eq 'information') {
print uc($name), " found - type : $atts{'type'}\n";
}
}
my xml file
<?xml version="1.0" encoding="windows-1250"?>
<root value="x">
<entreprise>some text</entreprise>
<info></info>
<client>
<nom name="paul">
<information valeur="Niveau" type="Bon"/>
<information valeur="Solvable" type="Mauvais"/>
</nom>
</client>
<client>
<nom name="albine">
<information valeur="Solvable" type="Bon"/>
</nom>
</client>
<client>
<nom name="Terence">
<information valeur="Niveau" type="Tres bon"/>
<information valeur="Solvable" type="Bon"/>
<information valeur="Ancien" type="Oui"/>
</nom>
</client>
</root>
when i launch the script i've nothing ???
normally i must have this result
information found - type : Bon
information found - type : Mauvais
information found - type : Bon
information found - type : Tres bon
information found - type : Bon
information found - type : Oui
why i've not this ???
thanks