我正在使用 XmlSlurper 解析一个脏 html 页面,我收到以下错误:
ERROR org.xml.sax.SAXParseException: Element type "scr" must be followed by either attribute specifications, ">" or "/>".
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
...
[Fatal Error] :1157:22: Element type "scr" must be followed by either attribute specifications, ">" or "/>".
现在,我有 html 我提供它并在这样做之前打印它。如果我打开它并尝试转到错误中提到的行 1157,那里没有“src”(但文件中有数百个这样的字符串)。所以我猜想插入一些额外的东西(可能<script>
或类似的东西)会改变行号。
有没有一种好方法可以准确地找到有问题的行或 html 片段?