HTML java 代码中的解析异常 org.xml.sax.SAXParseException
HTML Parsing Exception in java code org.xml.sax.SAXParseException
我正在尝试通过 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 文档。
您可以使用像 jsoup 这样的 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 文档。
您可以使用像 jsoup 这样的 html 解析器。