有没有办法用 xmllint 来捕捉这个?(我不需要使用 XSD 检查通用树结构). 解决方案 xmllint --noout your_test_file.xml检查此命令的返回码.请参阅文档.遇到基本解析错误时返回1的值.例如:echo $?I am having a problem with some XML print files where the source system omits to convert some characters to their XML syntax equivalent (e.g. & is not converted to &).Is there a way to catch this with xmllint? (I don't need to check the general tree structure using XSD). 解决方案 xmllint --noout your_test_file.xmlCheck for return code of this command. See documentation. Value of 1 is returned when basic parsing errors are met. E.g.:echo $? 这篇关于使用 xmllint 检查 XML 语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-11 12:07