Given a document like this
<root>
<settings>
<cache-size id="THIS">120</cache-size>
<restub-days>6</restub-days>
</settings>
</root>
the XPath expression selects the node I marked with ID THIS
, and thus the whole method returns 120
(n.getText()
). As a side note, it'd be better to use Enum.name()
instead of toString()
to get the name of the constant, because toString() can be overridden to return a different text.