# Class xpath

- Defined in File xpath.hpp

## Class Documentation

class xpath

  Class encapsulating an XPath.

  The actual xpath implementation. It expects an xpath in the constructor and this path must be UTF-8 encoded.

  Public Functions

  explicit xpath(std::string_view path)

    constructor taking a UTF-8 encoded xpath in path

  xpath(const xpath &rhs) = default

    copy constructor

  inline xpath(xpath &&rhs) noexcept

    move constructor

  inline xpath &operator=(xpath xp)

    assignment operator

  template<typename T>
  std::vector<T*> evaluate(const node &root, const context &ctxt = {}) const

    Evaluate an XPath and return a node_set. If you’re only interested in zeem::element results, you should call the evaluate<element>() instantiation. Use ctxt to provide values for variables.

  bool matches(const node *n, const context &ctxt = {}) const

    Returns true if the n node matches the XPath Use ctxt to provide values for variables.