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

Function xmlXPtrBuildNodeList

ThirdParty/libxml2/vtklibxml2/xpointer.c:1590–1664  ·  view source on GitHub ↗

* xmlXPtrBuildNodeList: * @obj: the XPointer result from the evaluation. * * Build a node list tree copy of the XPointer result. * This will drop Attributes and Namespace declarations. * * Returns an xmlNodePtr list or NULL. * the caller has to free the node tree. */

Source from the content-addressed store, hash-verified

1588 * the caller has to free the node tree.
1589 */
1590xmlNodePtr
1591xmlXPtrBuildNodeList(xmlXPathObjectPtr obj) {
1592 xmlNodePtr list = NULL, last = NULL;
1593 int i;
1594
1595 if (obj == NULL)
1596 return(NULL);
1597 switch (obj->type) {
1598 case XPATH_NODESET: {
1599 xmlNodeSetPtr set = obj->nodesetval;
1600 if (set == NULL)
1601 return(NULL);
1602 for (i = 0;i < set->nodeNr;i++) {
1603 if (set->nodeTab[i] == NULL)
1604 continue;
1605 switch (set->nodeTab[i]->type) {
1606 case XML_TEXT_NODE:
1607 case XML_CDATA_SECTION_NODE:
1608 case XML_ELEMENT_NODE:
1609 case XML_ENTITY_REF_NODE:
1610 case XML_ENTITY_NODE:
1611 case XML_PI_NODE:
1612 case XML_COMMENT_NODE:
1613 case XML_DOCUMENT_NODE:
1614 case XML_HTML_DOCUMENT_NODE:
1615 case XML_XINCLUDE_START:
1616 case XML_XINCLUDE_END:
1617 break;
1618 case XML_ATTRIBUTE_NODE:
1619 case XML_NAMESPACE_DECL:
1620 case XML_DOCUMENT_TYPE_NODE:
1621 case XML_DOCUMENT_FRAG_NODE:
1622 case XML_NOTATION_NODE:
1623 case XML_DTD_NODE:
1624 case XML_ELEMENT_DECL:
1625 case XML_ATTRIBUTE_DECL:
1626 case XML_ENTITY_DECL:
1627 continue; /* for */
1628 }
1629 if (last == NULL)
1630 list = last = xmlCopyNode(set->nodeTab[i], 1);
1631 else {
1632 xmlAddNextSibling(last, xmlCopyNode(set->nodeTab[i], 1));
1633 if (last->next != NULL)
1634 last = last->next;
1635 }
1636 }
1637 break;
1638 }
1639 case XPATH_LOCATIONSET: {
1640 xmlLocationSetPtr set = (xmlLocationSetPtr) obj->user;
1641 if (set == NULL)
1642 return(NULL);
1643 for (i = 0;i < set->locNr;i++) {
1644 if (last == NULL)
1645 list = last = xmlXPtrBuildNodeList(set->locTab[i]);
1646 else
1647 xmlAddNextSibling(last,

Callers

nothing calls this directly

Calls 3

xmlCopyNodeFunction · 0.85
xmlAddNextSiblingFunction · 0.85

Tested by

no test coverage detected