示例#1
0
void NavigationTable::LoadChildElements(shared_ptr<NavigationElement> pElement, xmlNodePtr olNode)
{
#if EPUB_COMPILER_SUPPORTS(CXX_INITIALIZER_LISTS)
    XPathWrangler xpath(olNode->doc, {{"epub", ePub3NamespaceURI}});
#else
    XPathWrangler::NamespaceList __ns;
    __ns["ePub3"] = ePub3NamespaceURI;
    XPathWrangler xpath(olNode->doc, __ns);
#endif
    xpath.NameDefaultNamespace("html");

    xmlNodeSetPtr liNodes = xpath.Nodes("./html:li", olNode);

    for ( int i = 0; i < liNodes->nodeNr; i++ )
    {
        auto childElement = BuildNavigationPoint(liNodes->nodeTab[i]);
        if ( childElement )
        {
            pElement->AppendChild(childElement);
        }
    }

    xmlXPathFreeNodeSet(liNodes);
}