tags:

views:

12

answers:

2

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  A: 

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.

Steve Townsend
Tony
Did you try `const TiXmlBase* outputnode(0);`? I don't have the library, so cannot try this.
Steve Townsend
@Tony - see edit, I found a sample that uses `TiXmlBase` and casts the result to what is needed. Edited reply accordingly.
Steve Townsend
A: 

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.

Lucas CImon