"Opening and ending tag mismatch" 的 `xmlstarlet sel`
"Opening and ending tag mismatch" of `xmlstarlet sel`
http://doi.cnki.net/Resolution/Handler?doi=10.13345/j.cjb.180087
当我 运行 xmlstarlet sel -t -v '//i[@class = "iconSucc"]/@class'
处理以下文件时,我收到以下错误消息。有人知道如何解决这个问题吗?
-:77.294: Opening and ending tag mismatch: img line 77 and a
middle;" src="/Content/images/gongshangbiaoshi.gif" alt="" class="footpic"></a>
^
-:77.301: Opening and ending tag mismatch: a line 77 and span
;" src="/Content/images/gongshangbiaoshi.gif" alt="" class="footpic"></a></span>
^
-:77.332: Opening and ending tag mismatch: span line 77 and p
i.gif" alt="" class="footpic"></a></span><br />©2014-2018中国知网(CNKI) </p
^
-:79.15: Opening and ending tag mismatch: p line 74 and div
</div>
^
-:92.8: Opening and ending tag mismatch: div line 61 and body
</body>
^
-:93.8: Opening and ending tag mismatch: body line 11 and html
</html>
^
-:94.1: Premature end of data in tag html line 2
^
您的 HTML 文件格式不正确。第 77 行的 <img>
元素
<img style="height: 24px; border: 0px none; vertical-align: middle;" src="/Content/images/gongshangbiaoshi.gif" alt="" class="footpic" >
没有关闭。添加结束标记 ... />
使其 格式正确 :
<img style="height: 24px; border: 0px none; vertical-align: middle;" src="/Content/images/gongshangbiaoshi.gif" alt="" class="footpic" />
那么输出将是:
iconSucc
编辑:
使用xmllint
,一条命令就可以达到结果:
xmllint -html -xmlout Handler.xml | xmlstarlet sel -t -v '//i[@class = "iconSucc"]/@class'
http://doi.cnki.net/Resolution/Handler?doi=10.13345/j.cjb.180087
当我 运行 xmlstarlet sel -t -v '//i[@class = "iconSucc"]/@class'
处理以下文件时,我收到以下错误消息。有人知道如何解决这个问题吗?
-:77.294: Opening and ending tag mismatch: img line 77 and a
middle;" src="/Content/images/gongshangbiaoshi.gif" alt="" class="footpic"></a>
^
-:77.301: Opening and ending tag mismatch: a line 77 and span
;" src="/Content/images/gongshangbiaoshi.gif" alt="" class="footpic"></a></span>
^
-:77.332: Opening and ending tag mismatch: span line 77 and p
i.gif" alt="" class="footpic"></a></span><br />©2014-2018中国知网(CNKI) </p
^
-:79.15: Opening and ending tag mismatch: p line 74 and div
</div>
^
-:92.8: Opening and ending tag mismatch: div line 61 and body
</body>
^
-:93.8: Opening and ending tag mismatch: body line 11 and html
</html>
^
-:94.1: Premature end of data in tag html line 2
^
您的 HTML 文件格式不正确。第 77 行的 <img>
元素
<img style="height: 24px; border: 0px none; vertical-align: middle;" src="/Content/images/gongshangbiaoshi.gif" alt="" class="footpic" >
没有关闭。添加结束标记 ... />
使其 格式正确 :
<img style="height: 24px; border: 0px none; vertical-align: middle;" src="/Content/images/gongshangbiaoshi.gif" alt="" class="footpic" />
那么输出将是:
iconSucc
编辑:
使用xmllint
,一条命令就可以达到结果:
xmllint -html -xmlout Handler.xml | xmlstarlet sel -t -v '//i[@class = "iconSucc"]/@class'