Ask a Question related to Perl / CGI, Design and Development.

  1. #1

    Default HTML::Parser

    Greetings,

    How should i use HTML::Parser to extract text bettween font tags with
    attibuts like this:
    <font face="Arial" size="2"> the text to extract </font>

    Thanks

    Franck
    franck Guest

  2. Similar Questions and Discussions

    1. Possible bug in HTML::Parser
      Hello. I am using the HTML::Parser module to parse a list of bookmarks exported from the Firefox browser. Firefox exports bookmarks to an HTML...
    2. HTML Parser
      Try something like this. This does send any form information, but only gets the html markup of the page. If you want to send form or query data that...
    3. HTML-Parser-3.35
      "Brad Olin" <bwo@bwo1.com> wrote in message news:qvmg001be5ge2qs9o23561il50urj0lcb5@4ax.com... Very puzzling. Are you sure you don't have LWP...
    4. HTML-Parser / SGML-Parser
      Ok, silly question. I am writing a script to determine my router's WAN ip address and then to email me once an hour in case it changes. Currently...
    5. How to use HTML::Parser to remove HTML tags and print result
      I am trying to use HTML::Parser to parse an HTML file, remove all HTML tags (including comments, etc.), replace all ENTITIES (e.g. &amp), and put...
  3. #2

    Default Re: HTML::Parser

    Tim Heaney <theaney@cablespeed.com> writes:
    > "franck" <f.collineau@voila.fr> writes:
    > >
    > > How should i use HTML::Parser to extract text bettween font tags with
    > > attibuts like this:
    > > <font face="Arial" size="2"> the text to extract </font>
    >
    > How about something like this?
    [...]
    > my %want = (tag => 'font',
    > attrs => { face => "Arial", size => "2" });
    >
    > sub start_handler {
    > my($tag, $attr) = @_;
    > return unless $tag eq $want{tag};
    This kind of filtering can also be done by setting up the
    'report_tags' attribute of the parser itself. That way of doing it is
    much more efficient as it reduce the number of callbacks invoked
    dramatically.

    $parser->report_tags($want{tag});

    --
    Gisle Aas
    Gisle Aas Guest

  4. #3

    Default Re: HTML::Parser

    Gisle Aas <gisle@ashn89ty262h.bc.hsia.telus.net> writes:
    >
    > This kind of filtering can also be done by setting up the
    > 'report_tags' attribute of the parser itself. That way of doing it is
    > much more efficient as it reduce the number of callbacks invoked
    > dramatically.
    >
    > $parser->report_tags($want{tag});
    Ah, yes. Thanks! In addition to the efficiency argument, I think it
    improves the readablility of both start_h and end_h too.

    Thanks again,

    Tim
    Tim Heaney Guest

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139