* xmlXPtrGetChildNo: * @ctxt: the XPointer Parser context * @index: the child number * * Move the current node of the nodeset on the stack to the * given child if found */
| 879 | * given child if found |
| 880 | */ |
| 881 | static void |
| 882 | xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int indx) { |
| 883 | xmlNodePtr cur = NULL; |
| 884 | xmlXPathObjectPtr obj; |
| 885 | xmlNodeSetPtr oldset; |
| 886 | |
| 887 | CHECK_TYPE(XPATH_NODESET); |
| 888 | obj = valuePop(ctxt); |
| 889 | oldset = obj->nodesetval; |
| 890 | if ((indx <= 0) || (oldset == NULL) || (oldset->nodeNr != 1)) { |
| 891 | xmlXPathFreeObject(obj); |
| 892 | valuePush(ctxt, xmlXPathNewNodeSet(NULL)); |
| 893 | return; |
| 894 | } |
| 895 | cur = xmlXPtrGetNthChild(oldset->nodeTab[0], indx); |
| 896 | if (cur == NULL) { |
| 897 | xmlXPathFreeObject(obj); |
| 898 | valuePush(ctxt, xmlXPathNewNodeSet(NULL)); |
| 899 | return; |
| 900 | } |
| 901 | oldset->nodeTab[0] = cur; |
| 902 | valuePush(ctxt, obj); |
| 903 | } |
| 904 | |
| 905 | /** |
| 906 | * xmlXPtrEvalXPtrPart: |
no test coverage detected