我尝试使用 lxml 在 Python 中解析 XML 文件,如下所示:
objectify.parse(xmlPath, parserWithSchema)
但 XML 文件可能在奇怪的地方包含注释:
<root>
<text>Sam<!--comment-->ple text</text>
<!--comment-->
<float>1.2<!--comment-->3456</float>
</root>
这是一种在解析之前不加载或删除评论的方法吗?