[HTML::Parser] Problème Attributs dans une balise
Bonjour à tous,
J' ai souhaité parser un page html à l'aide du module HTML :: Parser...TOUT FONCTIONNE !!
Code:
1 2 3
| my $parser = HTML::Parser->new(start_h => [\&start_rtn,"tag, attr"],
text_h => [\&text_rtn, "text"],
end_h => [\&end_rtn, "tag"]); |
Cependant, je rencontre des balises du style :
Code:
<a href="/redirect.jsp?p=http%3A%2F%2Fgenome" target="offsite">chr19:11058965</a>
On y trouve 2 attributs (attr) :
href
target
Je ne connais pas la synthaxe pour parser 2 attributs dans une balise. Je ne sais le faire ou il y a qu'un seul attribut (href par exemple)
Exemple :
Code:
1 2 3
| if ($tag =~ /^a$/ and defined $attr->{href} and $attr->{href} =~ /^\/views\/reports\/loadVariantReport.action?/){
$flag = 3;
} |
Pouvez vous m'aider (Récupérer le texte entre 2 balises, ou je trouve 2 attributs (href et target))
Merci