我正在尝试通过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)
答案 0 :(得分:1)
您不使用XML解析器来解析HTML文档,甚至不使用xhtml文档。
您可以使用像jsoup这样的html解析器。