[xml] XPath child axis traversal is broken when docb is disabled (libxml2 2.6.27)



If you compile libxml2 with "--without-docb" option then
XPath child axis traversal is broken due to the following
ifdef in the xmlXPathNextDescendantOrSelfElemParent()
function:

        while (cur != NULL) {
            switch (cur->type) {
                case XML_ELEMENT_NODE:
                /* TODO: OK to have XInclude here? */
                case XML_XINCLUDE_START:
                case XML_DOCUMENT_FRAG_NODE:            
                    if (cur != start)
                        return(cur);
                    if (cur->children != NULL) {
                        cur = cur->children;
                        continue;
                    }
                    break;
#ifdef LIBXML_DOCB_ENABLED
                /* Not sure if we need those here. */
                case XML_DOCUMENT_NODE:
                case XML_DOCB_DOCUMENT_NODE:
#endif
                case XML_HTML_DOCUMENT_NODE:
                    if (cur != start)
                        return(cur);
                    return(xmlDocGetRootElement((xmlDocPtr) cur));
                default:
                    break;
            }   

It seems that the right thing to do is to simply move the
"case XML_DOCUMENT_NODE:" out of this particular ifdef but
I am not familiar enough with DOCB stuff to tell the consequences
of this.

Best,
Aleksey






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]