PrevUpHome

Class xpath

zeep::xml::xpath

Synopsis

// In header: </home/maarten/projects/libzeep/zeep/xml/xpath.hpp>


class xpath {
public:
  // construct/copy/destruct
  xpath(const std::string &);
  xpath(const char *);
  xpath(const xpath &);
  xpath& operator=(const xpath &);

  // public member functions
  template<typename NODE_TYPE> 
    std::list< NODE_TYPE * > evaluate(const node &) const;
  template<typename NODE_TYPE> 
    std::list< NODE_TYPE * > evaluate(const node &, context &) const;
  bool matches(const node *) const;
};

Description

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

xpath public construct/copy/destruct

  1. xpath(const std::string & path);
  2. xpath(const char * path);
  3. xpath(const xpath & rhs);
  4. xpath& operator=(const xpath &);

xpath public member functions

  1. template<typename NODE_TYPE> 
      std::list< NODE_TYPE * > evaluate(const node & root) const;

    evaluate returns a node_set. If you're only interested in zeep::xml::element results, you should call the evaluate<element>() instantiation.

  2. template<typename NODE_TYPE> 
      std::list< NODE_TYPE * > evaluate(const node & root, context & ctxt) const;
    The second evaluate method is used for xpaths that contain variables.
  3. bool matches(const node * n) const;
    Returns true if the n node matches the XPath.

PrevUpHome