> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/x/xml/xpath.md).

# XPath

```ruby
require('XML::XPath')

var x = %O<XML::XPath>.new(ARGF.slurp)

[x.findnodes('//item[1]')][0]
say [x.findnodes('//price')].map{x.getNodeText(_)}
[x.findnodes('//name')]
```

#### Output:

```
[14.5, 23.99, 4.95, 3.56]
```
