Limiting Toke::Parser



Hi

I'm trying to use Toke::Parse and would appreciate some advice.

My html is something like this

<div id="mainbody">
  <h1>advise you to</h1>
  <ul>
    
      <li>
            <a href="/Advice/apples">apples</a>
      </li>

      <li>
            <a href="/Advice/oranges">oranges</a>
      </li>
      <li>
            <a href="/Advice/pears">pears</a>
      </li>

  </ul>
    <div id="footer">  
          <p class="style1"><span class="siteName">Smartshopper</span> is provided by the <a href="http://www..fat.gov";>FatTrade</a>.</p>
          <p><span class="style3 noprint">

            <a href="http://fat.gov/copyright.html";>Copyright</a>
            <a href="http://www.fat.gov/disclaim.html";>Disclaimer</a>
            <a href="http://www.fat.gov/privacy.html";>Privacy</a>
        </span>
          </p>
    </div>
</div>

my toke paser snippet

while ( $tag = $stream->get_tag("div") ) {
    if ($tag->[1]{id} and $tag->[1]{id} eq 'mainbody') {
        while ($tag = $stream->get_tag('a')){
            print Dumper $tag;
        }
    }
}

my problem

How do I stop the parser when I reach "pears".

Thanks for the assist

CCJ




__________________________________________________________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html

Relevant Pages

  • Re: Simple HTML table structure issue/question.
    ... >> Thanks for the advice.. ... Im sure your recommendations are what I SHOULD ... but unfortunetly I know little of html .. ... > this mess in the first place. ...
    (alt.html)
  • Re: How to speed up a code loop with INSERT INTO query?
    ... Thanks everyone for the help and advice. ... I tried the link to html, ... Set rsEWB = CurrentDb.OpenRecordset ... Later, I can then loop through and parse these 800,000 strings into ...
    (comp.databases.ms-access)
  • Re: Help -- getting 100% height on borders
    ... have the slightest interest in actually understanding my question and ... content as text/html, then IE is treating it as HTML - regardless of the ... asking for advice and I've always had polite, ... Web Hosting by West Virginians, ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Simple HTML table structure issue/question.
    ... > Thanks for the advice.. ... Im sure your recommendations are what I SHOULD ... but unfortunetly I know little of html .. ... then the kind of variation between browsers that you're complaining ...
    (alt.html)
  • RE: Web-design in Fedora
    ... > intended to run under Apache/Fedora? ... > Any advice or suggestions gratefully received. ... I learned from a book called "HTML 4 for the world wide web" by Elizabeth Castro. ... But HTML 4 is a very solid, basic language that should run on most browsers. ...
    (Fedora)