c++ - TinyXpath v_get_xpath_base,第二个参数

标签 c++ tinyxpath

我在这里将什么作为第二个参数传递给v_get_xpath_base为了让它工作,无论我尝试什么,似乎总是有问题。该类是基类且无法实例化,或者该类无法强制转换。

我很茫然,有人能帮帮我吗?

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

就目前而言,TiXmlElement 无法转换为 const TiXmlBase*&

最佳答案

API 将向您返回匹配的节点 - 我想您需要这样的东西:

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

调用后,outputNode会指向匹配到的数据。似乎您必须使用 const TiXmlBase* 作为 outputnode 的类型。有 sample here就是这样做的。

请注意,根据 TinyXml 文档,这仅在您完成此操作后才有效:

Can only be used after a call to u_compute_xpath_node_set.

关于c++ - TinyXpath v_get_xpath_base,第二个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3988325/

相关文章:

c++ - 在静态库(C++、Eclipse CDT)中使用#ifdef

java - JNI 和 C++ - UnsatisfiedLinkError

xml - 如何选择具有特定属性的所有元素?使用 TinyXPath

c++ - 有没有办法使用 C++/Boost 或使用其他库从 xml 标记中删除 namespace

c++ - 为什么在两个不同的类中调用 TinyXPath 时,同一对象会给出不同的结果?

c++ - 结合 std::unique_ptr 和命名构造函数

c++ - SSE 内在函数 : masking a float and using bitwise and?

c++ - 一个指向指针的指针如何对应一个二维数组?

c++ - tinyxpath 1.3.1 是否支持 xpath 2.0?