Online XPath Tester is the current “go to” tool I use when I want to test XPath (online and for free). I prefer the one built-in to Stylus Studio, but that’s a paid for product that I cannot install on each client’s computer.

To actually learn XPath, I suggest the W3Schools site:

To test the tool, you can copy/paste a sample XML from here:

Step 1 – Paste in your XML to the tool


Step 2- Type in your XPath

For example, I typed in //book/title below. I have highlighted in yellow, because at first, it’s not intuitively obvious where to actually type in the XPath. Note: Do not type in the XPath in the Namespaces: box!


Step 3- View your results

The tool will leave your original XML on one tab of your browser, then the results will be opened in a new tab on your browser. This picture shows the original tab on the left, and the new tab on the right.

Note that the “” xml wrapper is added to keep the results as well-formed XML. When you run your XPath in C# or other tools, that will not happen.


Step 4- Retry as needed

When doing a complicated XPath, you might have to try several times. Close the results tab in your browser, and go back to your original tab to try again.

If you want to specify something like //ns1:books you can define namespace ns1 in the namespaces textarea at the top of the screen.  I haven’t placed with that much.  I tend to create XPath that uses the “localname” syntax, which is a little more difficult.  Use of this syntax is explained well on this StackOverflow page:

For example:

Additional XPATH resources/samples for dealing with local-name and namespaces

Here are some old posts of mine when learning to do XPath back in 2004, it hasn’t really changed since then:


Leave a Reply

Recent Posts




All Rights Reserved Theme by 404 THEME.