* xmlXPathNsLookup: * @ctxt: the XPath context * @prefix: the namespace prefix value * * Search in the namespace declaration array of the context for the given * namespace name associated to the given prefix * * Returns the value or NULL if not found */
| 4252 | * Returns the value or NULL if not found |
| 4253 | */ |
| 4254 | const xmlChar * |
| 4255 | xmlXPathNsLookup(xmlXPathContextPtr ctxt, const xmlChar *prefix) { |
| 4256 | if (ctxt == NULL) |
| 4257 | return(NULL); |
| 4258 | if (prefix == NULL) |
| 4259 | return(NULL); |
| 4260 | |
| 4261 | if (xmlStrEqual(prefix, (const xmlChar *) "xml")) |
| 4262 | return(XML_XML_NAMESPACE); |
| 4263 | |
| 4264 | if (ctxt->namespaces != NULL) { |
| 4265 | int i; |
| 4266 | |
| 4267 | for (i = 0;i < ctxt->nsNr;i++) { |
| 4268 | if ((ctxt->namespaces[i] != NULL) && |
| 4269 | (xmlStrEqual(ctxt->namespaces[i]->prefix, prefix))) |
| 4270 | return(ctxt->namespaces[i]->href); |
| 4271 | } |
| 4272 | } |
| 4273 | |
| 4274 | return((const xmlChar *) xmlHashLookup(ctxt->nsHash, prefix)); |
| 4275 | } |
| 4276 | |
| 4277 | /** |
| 4278 | * xmlXPathRegisteredNsCleanup: |
no test coverage detected