it's to obvious to do and to hard to find when searching on the wrong places, so I turn to my brethern monks (sisters aswell)

I just want different pieces of information from a HTML file, like 'Author' or 'Price', or 'Artist' - that worked fine using regex. Extracting information like 'Description' is a bit more complicated and I wanted to move on to the next level of HTML extracting, using some DOM and possibly XPath to find just those paragraphs needed...

trying to test some modules already failed on the first attempts - and fcourse this has to do with the fact that most HTML is NOT XML, missing closing tags mostly and therefor not capable to just hand to a parser. Another warning-sign on the road was the "&Amp;", not something I like to get trouble with, I will asume that those will be translated to the proper XML entities

I'm stuck

How do I get HTML into a nice XML object that I can traverse?
simple question... though


In reply to extracting data from HTML by Jurassic Monk

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, details, 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, summary, 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.