TinyXpath v_get_xpath_base, second parameter

2019-09-02 03:32发布

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*&

标签: c++ tinyxpath
2条回答
唯我独甜
2楼-- · 2019-09-02 04:00

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.

查看更多
Fickle 薄情
3楼-- · 2019-09-02 04:10

I got the same problem. Steve solution works fine but I don't see how to use outputnode after. It cannot be cast from TiXmlBase to TiXmlElement nor be directly used with method from this child class. I'm browsing the documentation without finding a way to manipulate this TiXmlBase pointer.

查看更多
登录 后发表回答