jsoup 处理自定义标签的问题 求解

有贝无患 发布于 2013/03/14 16:08
阅读 1K+
收藏 0
String temp = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title></title></head><body>"
+ "<div>"
+ "<table><ss:channels id=\"0\"  childindex=\"0\" startpos=\"0\" pagesize=\"\" childtype=\"1\">"
+ "<tr><td><ss:channel field=\"chnldesc\" >kljkl"//
+ "</ss:channel></td></tr>"//
+ "</ss:channels></table>" + "</div>" + "</body></html>";

Document document = Jsoup.parse(temp);
System.out.println(document.toString());


输出结果是:
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title></title>
</head>
<body>
  <div>
   <ss:channels id="0" childindex="0" startpos="0" pagesize="" childtype="1"></ss:channels>
   <table>
    <tbody>
     <tr>
      <td>
       <ss:channel field="chnldesc">
        kljkl
       </ss:channel></td>
     </tr>
    </tbody>
   </table>
  </div>
</body>
< /html>
查了一下原来是jsoup自动校验html语法造成的。请问如何关闭jsoup自动校验html语法功能,如何解决jsoup自定义标签解析的问题
加载中
0
i十十
i十十

解决了么?@有贝无患


返回顶部
顶部