* xmlXPathNodeSetContains: * @cur: the node-set * @val: the node * * checks whether @cur contains @val * * Returns true (1) if @cur contains @val, false (0) otherwise */
| 2808 | * Returns true (1) if @cur contains @val, false (0) otherwise |
| 2809 | */ |
| 2810 | int |
| 2811 | xmlXPathNodeSetContains (xmlNodeSetPtr cur, xmlNodePtr val) { |
| 2812 | int i; |
| 2813 | |
| 2814 | if ((cur == NULL) || (val == NULL)) return(0); |
| 2815 | if (val->type == XML_NAMESPACE_DECL) { |
| 2816 | for (i = 0; i < cur->nodeNr; i++) { |
| 2817 | if (cur->nodeTab[i]->type == XML_NAMESPACE_DECL) { |
| 2818 | xmlNsPtr ns1, ns2; |
| 2819 | |
| 2820 | ns1 = (xmlNsPtr) val; |
| 2821 | ns2 = (xmlNsPtr) cur->nodeTab[i]; |
| 2822 | if (ns1 == ns2) |
| 2823 | return(1); |
| 2824 | if ((ns1->next != NULL) && (ns2->next == ns1->next) && |
| 2825 | (xmlStrEqual(ns1->prefix, ns2->prefix))) |
| 2826 | return(1); |
| 2827 | } |
| 2828 | } |
| 2829 | } else { |
| 2830 | for (i = 0; i < cur->nodeNr; i++) { |
| 2831 | if (cur->nodeTab[i] == val) |
| 2832 | return(1); |
| 2833 | } |
| 2834 | } |
| 2835 | return(0); |
| 2836 | } |
| 2837 | |
| 2838 | /** |
| 2839 | * xmlXPathNodeSetAddNs: |
no test coverage detected