TinyXpath v_get_xpath_base, second parameter

狂风中的少年 提交于 2019-12-13 04:22:49

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/3988325/tinyxpath-v-get-xpath-base-second-parameter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!