I got some new information.
After changing actionName to "//game/action" i get two elements (the count is correct) but both contain the attribute name="rename"
what may be wrong in there?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
my xml file looks that way
<?xml version="1.0" encoding="UTF-8"?>
einen guten oder Schlechten Ausgang.-->
<game>
<switch end="good" id="1">
<modify type="attribute">
<path>//object/@name</path>
<objectid>1</objectid>
<modified>Kurt</modified>
</modify>
</switch>
<switch end="bad" id="2">
<modify type="attribute">
<path>//object/@active</path>
<objectid>1</objectid>
<modified>false</modified>
</modify>
</switch>
<object active="true" id="1" name="Hans"/>
<action name="kill">
<who>0</who>
<whom>1</whom>
<switches>2</switches>
</action>
<action name="rename">
<who>0</who>
<whom>1</whom>
<switches>1</switches>
</action>
</game>
now I got a request that looks that way
//game/action[@name='kill']
using that code
TinyXPath::xpath_processor prc(doc.FirstChild(), actionName.c_str());
unsigned ui = prc.u_compute_xpath_node_set();
#ifdef _TEST_
cout << "requesting " << actionName.c_str() << endl;
cout << ui << " items found " << endl;
#endif
returns the right number of elements (1).
getting my object using that code, my cout is rename.
for (unsigned i = 0; i < ui; i ++) {
TiXmlNode *item = prc.XNp_get_xpath_node(i);
#ifdef _TEST_
cout << TinyXPath::S_xpath_string(item, ACTION_NAME).c_str() << endl;
#endif
}
I played a little and to my simple mind, I only get the last Element that fits //game/action
other similar requests, too..
I'm using MinGW and TXPath 1.3.1..
I got some new information.
After changing actionName to "//game/action" i get two elements (the count is correct) but both contain the attribute name="rename"
what may be wrong in there?