Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Forgive me, but I'm not exactly sure if I understand your question. If I haven't, try to rephrase - with examples, if possible.

Now, by my understanding, you're trying to pick out a table with a <img ..> tag in the <th..> tag? I've never tried this myself, but it's quite possible that it's only evaluating text nodes - that is, the tag is markup, not content, even if it has attributes. This is obvious, because <img ..> is an empty tag - in X/HTML, it would be written <img ../>, making it plain it contains no text nodes.

Probably the best way will be to write your own parser in HTML::Parser, or (better) extend HTML::TableExtract to make it possible to use 'nodes' (the tags :) and their attributes within the evaluation. Or, if you're dealing with XHTML, you could parse it using an XML::Parser, and then use XML::XPath to generate a query which would automatically find your answer! (Check out XPath if you haven't before - you can search through parsed XML trees for tags based on their name, their text content, their attributes, their lineage, etc. - sooper :) That's the preferred way, probably, but I suspect you're parsing someone else's web pages, so I guess it's probably not possible.

Have I made any sense??


In reply to Re: using the headers method of HTML::TableExtract to find an image by kal
in thread using the headers method of HTML::TableExtract to find an image by brainpan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (5)
    As of 2019-06-19 02:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Is there a future for codeless software?



      Results (83 votes). Check out past polls.

      Notices?
      • (Sep 10, 2018 at 22:53 UTC) Welcome new users!