Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我现在使用 NSXMLParser 来解析 html,但是当遇到 html 中的“br”标签时,它会抛出不匹配的错误并停止解析,因为通常“/br”标签不会出现在 html 中。所以我想忽略这个不匹配错误继续解析,如何处理呢?
不是最好的解决方案,但您可能会考虑在解析之前进行一些正则表达式更正,例如:
$input =~ s/<br>/<br \/>/ig;