* xmlTextReaderLookupNamespace: * @reader: the xmlTextReaderPtr used * @prefix: the prefix whose namespace URI is to be resolved. To return * the default namespace, specify NULL * * Resolves a namespace prefix in the scope of the current element. * * Returns a string containing the namespace URI to which the prefix maps * or NULL in case of error. The string must be deallocate
| 2549 | * or NULL in case of error. The string must be deallocated by the caller. |
| 2550 | */ |
| 2551 | xmlChar * |
| 2552 | xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, const xmlChar *prefix) { |
| 2553 | xmlNsPtr ns; |
| 2554 | int result; |
| 2555 | |
| 2556 | if (reader == NULL) |
| 2557 | return(NULL); |
| 2558 | if (reader->node == NULL) |
| 2559 | return(NULL); |
| 2560 | |
| 2561 | result = xmlSearchNsSafe(reader->node, prefix, &ns); |
| 2562 | if (result < 0) { |
| 2563 | xmlTextReaderErrMemory(reader); |
| 2564 | return(NULL); |
| 2565 | } |
| 2566 | if (ns == NULL) |
| 2567 | return(NULL); |
| 2568 | return(readerStrdup(reader, ns->href)); |
| 2569 | } |
| 2570 | |
| 2571 | /** |
| 2572 | * xmlTextReaderMoveToAttributeNo: |
no test coverage detected