[xml] Possible to get XHTML output from HTMLparser?



I'm using libxml2 for an application that generates XHTML output. I've
recently needed to parse some nasty HTML tag soup input and incorporate
it into some of my pages. Libxml2's HTMLparser does a great job of
fixing up the bad HTML but it outputs HTML v4 markup. Is there any
existing function that will output XHTML markup from the HTMLparser? 

What I need is something like htmlNodeDump() but maybe called
xhtmlNodeDump().

If such a thing doesn't currently exist, what's the best approach to
writing one? I'm assuming I'd just need to walk the HTMLparser output
tree, closing empty elements, expanding stand-alone attributes, and
such. Looks like HTMLparser already fixes some things like making sure
attribute values are quoted.

-Steve




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]