Java代码org.xml.sax.saxparseexception中的HTML解析异常



我正在尝试通过DOM解析器读取.html文件,但是它在解析时给了我以下例外。

[Fatal Error] form3.html:559:133: The element type "font" must be terminated by the matching end-tag "</font>".
org.xml.sax.SAXParseException; systemId: file:/home/puja/Dnyaneshwar/WCD_14_02_17/FileConverter/resources/form3.html; lineNumber: 559; columnNumber: 133; The element type "font" must be terminated by the matching end-tag "</font>".
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:205)
    at DomConverter.main(DomConverter.java:25)

您不使用XML解析器来解析HTML文档,甚至不是XHTML文档。

您可以使用HTML解析器,例如JSOUP。

相关内容

最新更新