* xmlXPathDebugDumpObject: * @output: the FILE * to dump the output * @cur: the object to inspect * @depth: indentation level * * Dump the content of the object for debugging purposes */
| 1221 | * Dump the content of the object for debugging purposes |
| 1222 | */ |
| 1223 | void |
| 1224 | xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { |
| 1225 | int i; |
| 1226 | char shift[100]; |
| 1227 | |
| 1228 | if (output == NULL) return; |
| 1229 | |
| 1230 | for (i = 0;((i < depth) && (i < 25));i++) |
| 1231 | shift[2 * i] = shift[2 * i + 1] = ' '; |
| 1232 | shift[2 * i] = shift[2 * i + 1] = 0; |
| 1233 | |
| 1234 | |
| 1235 | fprintf(output, "%s", shift); |
| 1236 | |
| 1237 | if (cur == NULL) { |
| 1238 | fprintf(output, "Object is empty (NULL)\n"); |
| 1239 | return; |
| 1240 | } |
| 1241 | switch(cur->type) { |
| 1242 | case XPATH_UNDEFINED: |
| 1243 | fprintf(output, "Object is uninitialized\n"); |
| 1244 | break; |
| 1245 | case XPATH_NODESET: |
| 1246 | fprintf(output, "Object is a Node Set :\n"); |
| 1247 | xmlXPathDebugDumpNodeSet(output, cur->nodesetval, depth); |
| 1248 | break; |
| 1249 | case XPATH_XSLT_TREE: |
| 1250 | fprintf(output, "Object is an XSLT value tree :\n"); |
| 1251 | xmlXPathDebugDumpValueTree(output, cur->nodesetval, depth); |
| 1252 | break; |
| 1253 | case XPATH_BOOLEAN: |
| 1254 | fprintf(output, "Object is a Boolean : "); |
| 1255 | if (cur->boolval) fprintf(output, "true\n"); |
| 1256 | else fprintf(output, "false\n"); |
| 1257 | break; |
| 1258 | case XPATH_NUMBER: |
| 1259 | switch (xmlXPathIsInf(cur->floatval)) { |
| 1260 | case 1: |
| 1261 | fprintf(output, "Object is a number : Infinity\n"); |
| 1262 | break; |
| 1263 | case -1: |
| 1264 | fprintf(output, "Object is a number : -Infinity\n"); |
| 1265 | break; |
| 1266 | default: |
| 1267 | if (xmlXPathIsNaN(cur->floatval)) { |
| 1268 | fprintf(output, "Object is a number : NaN\n"); |
| 1269 | } else if (cur->floatval == 0) { |
| 1270 | /* Omit sign for negative zero. */ |
| 1271 | fprintf(output, "Object is a number : 0\n"); |
| 1272 | } else { |
| 1273 | fprintf(output, "Object is a number : %0g\n", cur->floatval); |
| 1274 | } |
| 1275 | } |
| 1276 | break; |
| 1277 | case XPATH_STRING: |
| 1278 | fprintf(output, "Object is a string : "); |
| 1279 | xmlDebugDumpString(output, cur->stringval); |
| 1280 | fprintf(output, "\n"); |
no test coverage detected