Commit abf598b5 authored by William M. Brack's avatar William M. Brack
Browse files

some further enhancement to take care of xml:base for XPointer elements

* xinclude.c: some further enhancement to take care of
  xml:base for XPointer elements (bug 143886).  Also fixed
  a problem when xml:base was already specified on an
  XInclude'd element.
parent 8eabb05d
Tue Jun 8 09:58:31 HKT 2004 William Brack <wbrack@mmm.com.hk>
* xinclude.c: some further enhancement to take care of
xml:base for XPointer elements (bug 143886). Also fixed
a problem when xml:base was already specified on an
XInclude'd element.
Mon Jun 7 22:14:58 HKT 2004 William Brack <wbrack@mmm.com.hk>
 
* relaxng.c: fixed a problem with internal cleanup of <DIV> element
......
......@@ -1563,6 +1563,7 @@ loaded:
xmlFree(fragment);
return(-1);
}
case XPATH_RANGE:
case XPATH_LOCATIONSET:
break;
......@@ -1575,7 +1576,6 @@ loaded:
switch (set->nodeTab[i]->type) {
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_ELEMENT_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_PI_NODE:
......@@ -1586,6 +1586,19 @@ loaded:
case XML_DOCB_DOCUMENT_NODE:
#endif
continue;
case XML_ELEMENT_NODE: {
xmlChar *nodeBase;
xmlNodePtr el = set->nodeTab[i];
nodeBase = xmlNodeGetBase(el->doc, el);
if (nodeBase != NULL) {
if (!xmlStrEqual(nodeBase, el->doc->URL))
xmlNodeSetBase(el, nodeBase);
xmlFree(nodeBase);
}
continue;
}
case XML_ATTRIBUTE_NODE:
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
XML_XINCLUDE_XPTR_RESULT,
......@@ -1638,6 +1651,7 @@ loaded:
if ((doc != NULL) && (URL != NULL) && (xmlStrchr(URL, (xmlChar) '/'))) {
xmlNodePtr node;
xmlChar *relURI;
xmlChar *curBase;
/*
* The base is only adjusted if necessary for the existing base
......@@ -1651,8 +1665,13 @@ loaded:
if (xmlStrchr(relURI, (xmlChar) '/')) {
node = ctxt->incTab[nr]->inc;
while (node != NULL) {
if (node->type == XML_ELEMENT_NODE)
xmlNodeSetBase(node, relURI);
if (node->type == XML_ELEMENT_NODE) {
curBase = xmlNodeGetBase(node->doc, node);
if ((curBase == NULL) || xmlStrEqual(curBase, node->doc->URL))
xmlNodeSetBase(node, relURI);
if (curBase != NULL)
xmlFree(curBase);
}
node = node->next;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment