Skip to content

Instantly share code, notes, and snippets.

@62mkv
Created January 7, 2021 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 62mkv/caafe38b23267f09a36c73003b232126 to your computer and use it in GitHub Desktop.
Save 62mkv/caafe38b23267f09a36c73003b232126 to your computer and use it in GitHub Desktop.
XPath cheatsheet

XPath cheatsheet

(inspired by this)

Find nodes with XPath expressions

  • / - root
  • x - element named "x"
  • x/y - all children of "x" named "y"
  • * any element
  • ancestor::x - any ancestor named "x"
  • x[3] - numbered predicate (third element in a collection of "x" elements)
  • x[@color='red'] - boolean predicate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment