I'm looking a php code or js code for converting html to xhtml. PHP tidy is not my option because my hosting does not support it.
+1
A:
a) Why the hell could you ever need XHTML?
b) To convert from HTML to well formed XML markup isn't easy. That's because HTML allows markup errors and tries to interpret them some way whereas the XML parser will murder itself if it encounters an error. So, do you want that the code is parsed by the HTML 5 parser and the resulting DOM tree is flattened to XML code? Or shall the markup be interpreted as HTML4 in IE7? Or as HTML4 in Firefox? Or ...? Or ...? Or ...?
nikic
2010-09-24 16:46:11
I create a template editor in browser. The output (from innerhtml) is not xhtml, so I need a converter.
complez
2010-09-24 17:58:22