Emmanuel Bourg dixit:

>I stumbled on the same issue when playing with Maven pom files and it
>seems to be a feature of xmlstarlet:
>
>   http://xmlstar.sourceforge.net/doc/UG/ch05s01.html
>
>If the document has a default namespace it has to be specified
>explicitly with the -N option and then prefixed to the name of the
>elements in the XPath expression:

Interesting, but… I don’t *know* ahead of the time if this is
true, if the files I work on are, say, HTML pages I scraped
from some remote website and, if necessary, ran through either
tidy or html5tidy to make something resembling XML out of them
for the sole procedure of using xmlstarlet sel.

>xmlstarlet sel -N xhtml=http://www.w3.org/1999/xhtml -T -t -c
>'//xhtml:h3[@id="baz"]' -n test2.xml
>
>This is rather annoying and the default namespace should probably be
>ignored, but at least there is a workaround.

I “just” want to get the values of some tags (and I do not wish
to “parse” XML using regex, as that is Just Not Done™), I don’t
care about namespaces and whatnot, so I consider this an anti‐
feature.

But thanks for the info!

bye,
//mirabilos
-- 
Thorsten Glaser (2. Vorstandsvorsitzender)
Teckids e.V. – Erkunden, Entdecken, Erfinden.
https://www.teckids.org/

Reply via email to