I have this sort of tags in an XML:
<command name="config">config show</command>
For example, to read that one with xpath I do:
//command[@name='config']
but this outs two strings: "config" and "show". I would like to be able to get a unique string: "config show".
I tried /text()
and /node()
but didn't work. Any idea?
For
<command name="check_config">config show</command>
this XPath,
//command[@name='check_config']
selects all command
elements in the document with a @name
attribute value equal to 'config'
; in this case, only the element shown above:
<command name="check_config">config show</command>
Should this element be evaluated in the context that automatically converts to a string, or should you force such a conversion via the string()
function,
string(//command[@name='check_config'])
it will be converted to the string value of that element,
config show
which is a single string, not two.