I'm having trouble understanding the difference between text()
and node()
. From what I understand, text()
would be whatever is in between the tags <item>apple</item>
which is apple in this case. Node would be whatever that node actually is, which would be item
But then I've been assigned some work where it asks me to "Select the text of all items under produce" and a separate question asks "Select all the manager nodes in all departments"
How is the output suppose to look text()
as opposed to node()
Snippet of XML:
<produce>
<item>apple</item>
<item>banana</item>
<item>pepper</item>
</produce>
<department>
<phone>123-456-7891</phone>
<manager>John</manager>
</department>
Of course, there are more departments and more managers, but this was just a snippet of code.
Any help would be much appreciated!
"*"
depends on the axis: with most axes, it selects element nodes, but with the attribute axis it selects attributes, and with the namespace axis it selects namespaces. (b)@*
and@foo
are not node-tests, but axis steps, consisting of two parts: an axis (@
, which is short forattribute::
), and a node-test (*
orfoo
). – Bunco