falcong / pugixml

Automatically exported from code.google.com/p/pugixml
0 stars 0 forks source link

Ignore second selector into square brackets #236

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Query
//test[@type='input'][last()]/input[last()]
not found nodes into pugi, but in 
http://www.xpathtester.com/xpath/b3b344ea86ac89da79534efdd13b0fd1
all is OK

My expected behavior is 
(.select_nodes(L"//test[@type='input']/input[last()]").end() - 1)
My try is
.select_single_node(L"//test[@type='input'][last()]/input[last()]")
I want to select last node into last test with type input.

Original issue reported on code.google.com by mrglu...@gmail.com on 28 Jul 2014 at 1:20

GoogleCodeExporter commented 9 years ago
This works fine with the attached source.

What version of pugixml are you using? Can you show the code sample that 
reproduces the problem?

Original comment by arseny.k...@gmail.com on 28 Jul 2014 at 3:56

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, silly mistake

pugi::xml_node question = m_test.last_child();
// question.append_attribute(L"type") = L"input"; problem with this string
const pugi::xml_attribute lastGroup = 
m_test.select_single_node(L"//test[@type='input'][last()]/input[last()]").node()
.attribute(L"group");
int number = (lastGroup ? lastGroup.as_int() + 1 : 0);

question.append_attribute(L"type") = L"input";

Awesome fast support :)

Original comment by mrglu...@gmail.com on 28 Jul 2014 at 4:51

GoogleCodeExporter commented 9 years ago
I'm slightly confused; can you confirm that this was a user error so that I can 
close the issue? Or do you still see the problem?

Original comment by arseny.k...@gmail.com on 10 Aug 2014 at 9:57

GoogleCodeExporter commented 9 years ago

Original comment by arseny.k...@gmail.com on 10 Aug 2014 at 9:57

GoogleCodeExporter commented 9 years ago
Closing since it seems to have been a user error.

Original comment by arseny.k...@gmail.com on 25 Aug 2014 at 5:29