c++tinyxpath

TinyXpath v_get_xpath_base, second parameter


What do I pass here as the second parameter to v_get_xpath_base in order to get it to work, no matter what I try, there always seems to be a problem. Either the class is a base class and cannot be instantiated or the class cannot be casted.

I'm at a loss, someone help me please?

        TiXmlElement* outputnode = new TiXmlElement("test");
  bool isAttrib;
  proc.v_get_xpath_base(1, outputnode, isAttrib);

As it currently stands, the TiXmlElement cannot be cast to const TiXmlBase*&


Solution

  • The API is going to return you the matching node - I imagine you need something like:

    const TiXmlBase* outputnode(0);
    bool isAttrib;
    proc.v_get_xpath_base(1, outputnode, isAttrib);
    

    and after the call, outputNode will point to the matched data. Seems like you have to use const TiXmlBase* as the type for outputnode. There is a sample here that does this.

    Note that this only works after you have done this, per the TinyXml docs:

    Can only be used after a call to u_compute_xpath_node_set.