MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlTextReaderValue

Function xmlTextReaderValue

ThirdParty/libxml2/vtklibxml2/xmlreader.c:3571–3609  ·  view source on GitHub ↗

* xmlTextReaderValue: * @reader: the xmlTextReaderPtr used * * Provides the text value of the node if present * * Returns the string or NULL if not available. The result must be deallocated * with xmlFree() */

Source from the content-addressed store, hash-verified

3569 * with xmlFree()
3570 */
3571xmlChar *
3572xmlTextReaderValue(xmlTextReaderPtr reader) {
3573 xmlNodePtr node;
3574 if (reader == NULL)
3575 return(NULL);
3576 if (reader->node == NULL)
3577 return(NULL);
3578 if (reader->curnode != NULL)
3579 node = reader->curnode;
3580 else
3581 node = reader->node;
3582
3583 switch (node->type) {
3584 case XML_NAMESPACE_DECL:
3585 return(readerStrdup(reader, ((xmlNsPtr) node)->href));
3586 case XML_ATTRIBUTE_NODE:{
3587 xmlAttrPtr attr = (xmlAttrPtr) node;
3588 xmlDocPtr doc = NULL;
3589 xmlChar *ret;
3590
3591 if (attr->children == NULL)
3592 return(NULL);
3593 if (attr->parent != NULL)
3594 doc = attr->parent->doc;
3595 ret = xmlNodeListGetString(doc, attr->children, 1);
3596 if (ret == NULL)
3597 xmlTextReaderErrMemory(reader);
3598 return(ret);
3599 }
3600 case XML_TEXT_NODE:
3601 case XML_CDATA_SECTION_NODE:
3602 case XML_PI_NODE:
3603 case XML_COMMENT_NODE:
3604 return(readerStrdup(reader, node->content));
3605 default:
3606 break;
3607 }
3608 return(NULL);
3609}
3610
3611/**
3612 * xmlTextReaderConstValue:

Callers 1

xmlSchemaVReaderWalkFunction · 0.85

Calls 3

readerStrdupFunction · 0.85
xmlNodeListGetStringFunction · 0.85
xmlTextReaderErrMemoryFunction · 0.85

Tested by

no test coverage detected