note
nan
<p>Hi guys,
<p>Thank you for your quicky replies. I think I found what's wrong inside xml document. It seems that only if a link contains character '&' then the parser reports an error.
<p>For example, <link r:resource="http://www.urbancinefile.com.au/home/article_view.asp?Article_ID=3801&Section=Reviews"/>
<p>As I need to read <link/> elements one by one and compare the attribute value with user's input, my new question is, how can I overcome this '&' problem? I have tried to use '\' before '&' but it doesn't work.
<p>Thanks again,
<readmore title="my relevant code">
sub topic {<br>
my $count = 0;<br>
my ($twig, $topic) = @_;<br>
$links{$_->att('r:resource')} = $_ for $topic->children('link');<br>
foreach my $key (keys %links){<br>
if ($key =~ /$q/i){<br>
print "<li>", $topic->att('r:id'), "</li>\n";<br>
$count++;<br>
}<br>
last if ($count == 1); #if keywords were found in one link, we don't need to check the others in the same node, because we aim to output parent category only.<br>
}<br>
print "</ul>\n";<br>
$twig->purge;<br>
%links = (); #reset the hash for next time use<br>
}<br>
</readmore>
Nan
471291
471295