开发者

Javascript HTML > XHTML converter

开发者 https://www.devze.com 2023-01-20 06:52 出处:网络
Looking for a HTML converter which will produce valid XHTML code. One important thing is that it will need to insert P tags for paragraphs - something that seems to be missing from most popular ones.

Looking for a HTML converter which will produce valid XHTML code. One important thing is that it will need to insert P tags for paragraphs - something that seems to be missing from most popular ones.

I found John Resig's, but it does not insert P tags.

http://ejohn.org/blog/pure-javascript-html-parser/

For example, this:

Lorem ips开发者_开发技巧um dolor sit amet, consectetuer adipiscing elit.<br/><br/> Aenean commodo ligula eget dolor. 

Would become this:

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
<p>Aenean commodo ligula eget dolor. </p>


This article explains how to convert using HTML Tidy and then do further processing using normal XML tools:

http://www.ibm.com/developerworks/library/x-tiptidy.html

0

精彩评论

暂无评论...
验证码 换一张
取 消