* xmlXPathNotEqualValues: * @ctxt: the XPath Parser context * * Implement the equal operation on XPath objects content: @arg1 == @arg2 * * Returns 0 or 1 depending on the results of the test. */
| 6200 | * Returns 0 or 1 depending on the results of the test. |
| 6201 | */ |
| 6202 | int |
| 6203 | xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { |
| 6204 | xmlXPathObjectPtr arg1, arg2, argtmp; |
| 6205 | int ret = 0; |
| 6206 | |
| 6207 | if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); |
| 6208 | arg2 = valuePop(ctxt); |
| 6209 | arg1 = valuePop(ctxt); |
| 6210 | if ((arg1 == NULL) || (arg2 == NULL)) { |
| 6211 | if (arg1 != NULL) |
| 6212 | xmlXPathReleaseObject(ctxt->context, arg1); |
| 6213 | else |
| 6214 | xmlXPathReleaseObject(ctxt->context, arg2); |
| 6215 | XP_ERROR0(XPATH_INVALID_OPERAND); |
| 6216 | } |
| 6217 | |
| 6218 | if (arg1 == arg2) { |
| 6219 | xmlXPathReleaseObject(ctxt->context, arg1); |
| 6220 | return(0); |
| 6221 | } |
| 6222 | |
| 6223 | /* |
| 6224 | *If either argument is a nodeset, it's a 'special case' |
| 6225 | */ |
| 6226 | if ((arg2->type == XPATH_NODESET) || (arg2->type == XPATH_XSLT_TREE) || |
| 6227 | (arg1->type == XPATH_NODESET) || (arg1->type == XPATH_XSLT_TREE)) { |
| 6228 | /* |
| 6229 | *Hack it to assure arg1 is the nodeset |
| 6230 | */ |
| 6231 | if ((arg1->type != XPATH_NODESET) && (arg1->type != XPATH_XSLT_TREE)) { |
| 6232 | argtmp = arg2; |
| 6233 | arg2 = arg1; |
| 6234 | arg1 = argtmp; |
| 6235 | } |
| 6236 | switch (arg2->type) { |
| 6237 | case XPATH_UNDEFINED: |
| 6238 | break; |
| 6239 | case XPATH_NODESET: |
| 6240 | case XPATH_XSLT_TREE: |
| 6241 | ret = xmlXPathEqualNodeSets(ctxt, arg1, arg2, 1); |
| 6242 | break; |
| 6243 | case XPATH_BOOLEAN: |
| 6244 | if ((arg1->nodesetval == NULL) || |
| 6245 | (arg1->nodesetval->nodeNr == 0)) ret = 0; |
| 6246 | else |
| 6247 | ret = 1; |
| 6248 | ret = (ret != arg2->boolval); |
| 6249 | break; |
| 6250 | case XPATH_NUMBER: |
| 6251 | ret = xmlXPathEqualNodeSetFloat(ctxt, arg1, arg2->floatval, 1); |
| 6252 | break; |
| 6253 | case XPATH_STRING: |
| 6254 | ret = xmlXPathEqualNodeSetString(ctxt, arg1, |
| 6255 | arg2->stringval, 1); |
| 6256 | break; |
| 6257 | case XPATH_USERS: |
| 6258 | #ifdef LIBXML_XPTR_LOCS_ENABLED |
| 6259 | case XPATH_POINT: |
no test coverage detected