For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > May 2006 > HTML to XML in Perl?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HTML to XML in Perl?
Ilya Zakharevich

2006-05-12, 7:57 am

Suppose I want to translate an HTML to a XML-well-formed HTML (so that
I can, e.g., apply xsltproc to the result). E.g., HTML::TreeBuilder
can apply "usual heuristics" to parse HTML; how to get XML out of it?

Thanks,
Ilya
John Bokma

2006-05-12, 9:56 pm

Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:

> Suppose I want to translate an HTML to a XML-well-formed HTML (so that
> I can, e.g., apply xsltproc to the result). E.g., HTML::TreeBuilder
> can apply "usual heuristics" to parse HTML; how to get XML out of it?


Question: I use XML, not XHTML, at home, and use XML::Twig to convert it
to HTML. I can use xsltproc if I want to on the XML file.

You might want to traverse the parse tree HTML::TreeBuilder generates.
Also, not 100% sure, but it might me that HTML tidy can do the XHTML
conversion for you:

Google...

"Validator fixes errors in HTML and XHTML. Converts HTML to XHTML. Free
Software."

http://www.google.com/search?q=html%20tidy%20xhtml

Sounds like it does :-D.

--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com