* xmlShellPrintXPathResultCtxt: * @ctxt: a valid shell context * @list: a valid result generated by an xpath evaluation * * Prints result to the output FILE */
| 1912 | * Prints result to the output FILE |
| 1913 | */ |
| 1914 | static void |
| 1915 | xmlShellPrintXPathResultCtxt(xmlShellCtxtPtr ctxt,xmlXPathObjectPtr list) |
| 1916 | { |
| 1917 | if (!ctxt) |
| 1918 | return; |
| 1919 | |
| 1920 | if (list != NULL) { |
| 1921 | switch (list->type) { |
| 1922 | case XPATH_NODESET:{ |
| 1923 | #ifdef LIBXML_OUTPUT_ENABLED |
| 1924 | int indx; |
| 1925 | |
| 1926 | if (list->nodesetval) { |
| 1927 | for (indx = 0; indx < list->nodesetval->nodeNr; |
| 1928 | indx++) { |
| 1929 | xmlShellPrintNodeCtxt(ctxt, |
| 1930 | list->nodesetval->nodeTab[indx]); |
| 1931 | } |
| 1932 | } else { |
| 1933 | fprintf(ctxt->output, |
| 1934 | "Empty node set\n"); |
| 1935 | } |
| 1936 | break; |
| 1937 | #else |
| 1938 | fprintf(ctxt->output, |
| 1939 | "Node set\n"); |
| 1940 | #endif /* LIBXML_OUTPUT_ENABLED */ |
| 1941 | } |
| 1942 | case XPATH_BOOLEAN: |
| 1943 | fprintf(ctxt->output, |
| 1944 | "Is a Boolean:%s\n", |
| 1945 | xmlBoolToText(list->boolval)); |
| 1946 | break; |
| 1947 | case XPATH_NUMBER: |
| 1948 | fprintf(ctxt->output, |
| 1949 | "Is a number:%0g\n", list->floatval); |
| 1950 | break; |
| 1951 | case XPATH_STRING: |
| 1952 | fprintf(ctxt->output, |
| 1953 | "Is a string:%s\n", list->stringval); |
| 1954 | break; |
| 1955 | |
| 1956 | default: |
| 1957 | xmlShellPrintXPathError(list->type, NULL); |
| 1958 | } |
| 1959 | } |
| 1960 | } |
| 1961 | |
| 1962 | /** |
| 1963 | * xmlShellPrintXPathResult: |
no test coverage detected