* xmlXPathRegisterVariableNS: * @ctxt: the XPath context * @name: the variable name * @ns_uri: the variable namespace URI * @value: the variable value or NULL * * Register a new variable value. If @value is NULL it unregisters * the variable * * Returns 0 in case of success, -1 in case of error */
| 4084 | * Returns 0 in case of success, -1 in case of error |
| 4085 | */ |
| 4086 | int |
| 4087 | xmlXPathRegisterVariableNS(xmlXPathContextPtr ctxt, const xmlChar *name, |
| 4088 | const xmlChar *ns_uri, |
| 4089 | xmlXPathObjectPtr value) { |
| 4090 | if (ctxt == NULL) |
| 4091 | return(-1); |
| 4092 | if (name == NULL) |
| 4093 | return(-1); |
| 4094 | |
| 4095 | if (ctxt->varHash == NULL) |
| 4096 | ctxt->varHash = xmlHashCreate(0); |
| 4097 | if (ctxt->varHash == NULL) |
| 4098 | return(-1); |
| 4099 | if (value == NULL) |
| 4100 | return(xmlHashRemoveEntry2(ctxt->varHash, name, ns_uri, |
| 4101 | xmlXPathFreeObjectEntry)); |
| 4102 | return(xmlHashUpdateEntry2(ctxt->varHash, name, ns_uri, |
| 4103 | (void *) value, xmlXPathFreeObjectEntry)); |
| 4104 | } |
| 4105 | |
| 4106 | /** |
| 4107 | * xmlXPathRegisterVariableLookup: |
no test coverage detected