开发者

can anybody post tutorial links for jtidy to convert xhtml to xml

开发者 https://www.devze.com 2022-12-14 11:05 出处:网络
can anybody give sample program for converting xhtml doc to xml using jtidy in java. or otherwise post the tutorial开发者_StackOverflow中文版 link for using jtidyYou might find these examples interes

can anybody give sample program for converting xhtml doc to xml using jtidy in java.

or otherwise post the tutorial开发者_StackOverflow中文版 link for using jtidy


You might find these examples interesting.


A XHTML document is already a XML document, so basically you don't have to do anything.


You can use a simple code for this;

Tidy tidy = new Tidy();
tidy.setMakeClean(true);
tidy.setXmlOut( true);

URL url = new URL("url_string_here");

FileOutputStream fileOutputStream = new FileOutputStream("outXHTML.xml");   

Document doc = tidy.parseDOM( url.openStream(), fileOutputStream);

Hope this helps.

0

精彩评论

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