Why does this XPath expression not return the correct value in xmlstarlet?

♀尐吖头ヾ 提交于 2019-12-01 01:12:29
MiMo

You need to define and use a namespace prefix for http://earth.google.com/kml/2.2 test.kml - something like this:

xmlstarlet sel -t -c "//kml:coordinates/text()" -N kml=http://earth.google.com/kml/2.2 test.kml

XPaths do not have a default namespace - if a name in a XPath does not specify a namespace prefix it is assumed to be in the null namespace; hence it is necessary to always specify a namespace prefix when trying to match nodes whose names are in a namespace different from the null one (as in this case).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!