in reply to HTML::Treebuilder look_down not working with <header>, <article> etc

What could be the Isssue?

Not enough manual reading/understanding

$ perl -MHTML::Tree -e " print HTML::Tree->new_from_content(q{<header> +<article>})->as_HTML" <html><head></head><body></body></html> $ perl -MHTML::Tree -le " print HTML::Tree->new(qw{ ignore_unknown 0 } +)->parse_content(q{<header><article>})->as_HTML" <html><head></head><body></body><header><article></article></header></ +html> $ perl -MHTML::HTML5::Parser -le " print HTML::HTML5::Parser->load_htm +l( string => \q{<header><article>}) " <?xml version="1.0" encoding="utf-8"?> <html xmlns="http://www.w3.org/1999/xhtml"><head/><body><header><artic +le/></header></body></html> $ perl -MMojo::DOM -le " print Mojo::DOM->new( q{<header><article>} ) +" <header><article></article></header>
$ perl -MXML::LibXML -le " print XML::LibXML->new( qw/ recover 2 / )->load_html( string => q{<header><article>} ); " <?xml version="1.0" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><header><article/></header></body></html> </c>

htmltreexpather.pl , Parsing HTML / Re^4: Parsing HTML, A regex question , NASA's Astronomy Picture of the Day / Re: NASA's Astronomy Picture of the Day , Re: Extracting HTML content between the h tags, Re^2: Help With Online Table Scraper, Re^4: web::scraper using an xpath, .... HTML Parser suggestions, Extract Portion of HTML

  • Comment on Re: HTML::Treebuilder look_down not working with <header>, <article> etc
  • Download Code

Replies are listed 'Best First'.
Re^2: HTML::Treebuilder look_down not working with <header>, <article> etc
by Anonymous Monk on May 07, 2014 at 10:51 UTC
    Erm. Yes. I still don't get it. Anyone can explain that code further?

      <header> and <article> are not HTML tags. HTML::TreeBuilder seems to ignore tags that are not HTML tags. So I would guess that HTML::TreeBuilder is the wrong tool to process things that are not HTML.

      The rest of the post of Anonymous Monk shows you an alternative approach using XML::LibXML. Maybe you should pursue that one.

      Erm. Yes. I still don't get it. Anyone can explain that code further?

      Sure, if you can explain what -- its like saying "doesn't work" ... great, ok then, have a nice day