Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: HTML tidy, using XML::LibXML

by Matts (Deacon)
on Jan 04, 2003 at 17:10 UTC ( #224278=note: print w/replies, xml ) Need Help??


in reply to HTML tidy, using XML::LibXML

If you've got sloppy HTML that needs tidying up and XML::LibXML barfs on it, you can change that one-liner to the following three-liner:
my $parser = XML::LibXML->new(); $parser->recover(1); # Set recovery on error flag $parser->parse_html_string(join "", <>)->toStringHTML;
XML::LibXML can also parse SGML. Most people don't know that (probably sucky docs ;-)

Replies are listed 'Best First'.
Re^2: HTML tidy, using XML::LibXML
by Your Mother (Chancellor) on Sep 01, 2007 at 05:43 UTC

    Don't know if it's accurate but the docs say that won't work-

    This switch (recover) will only work with XML data rather than HTML data.

    (Update, July 2010: this does work and has for at least a few years -- don't know if it was always the case; I should have tested back when I initially responded.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://224278]
help
Chatterbox?
[Lady_Aleena]: Discipulus, do glob recurse?
[Lady_Aleena]: s/do/does/;
LanX wants to be fired
[Discipulus]: i fear no
[Discipulus]: i invented also 'gired'
[Lady_Aleena]: Discipulus, then that is a problem. I wanted to find total seconds of my entire .mp3 collection to do some math on it to see how many days of continuous music i have.
[LanX]: darn. .. I wanted to see Marine and Melonchon go to next round, just for fun xD
[Discipulus]: LA use Perl: traversing a dir tree is simple; foreach file mp3 $sec+= use Mp3::Info
[Lady_Aleena]: Discipulus, I was able to get the sum of the seconds on the command line using awk. Then I ran the result through a perl script and got the result. It came bach with 4 days, 9 hours, 56 minutes, 43 seconds.

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2017-04-23 20:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.