--- /home/olaf/devel/libxml/xinclude.c	2008-09-16 11:48:52.000000000 +0200
+++ xinclude.c	2008-09-19 09:55:59.000000000 +0200
@@ -1811,6 +1811,8 @@
     int i;
     xmlChar *encoding = NULL;
     xmlCharEncoding enc = (xmlCharEncoding) 0;
+    xmlParserCtxtPtr pctxt;
+    xmlParserInputPtr inputStream;
 
     /*
      * Check the URL and remove any fragment identifier
@@ -1885,8 +1887,14 @@
     /*
      * Load it.
      */
-    buf = xmlParserInputBufferCreateFilename((const char *)URL, enc);
+    pctxt = xmlNewParserCtxt();
+    inputStream = xmlLoadExternalEntity((const char*)URL, NULL, pctxt);
+    if(inputStream == NULL) {
+	return(-1);
+    }
+    buf = inputStream->buf;
     if (buf == NULL) {
+	xmlFreeParserCtxt(pctxt);
 	xmlFree(URL);
 	return(-1);
     }
@@ -1923,8 +1931,9 @@
 	xmlBufferShrink(buf->buffer, len);
     }
-    xmlFreeParserInputBuffer(buf);
+    xmlFreeParserCtxt(pctxt);
     xmlXIncludeAddTxt(ctxt, node, URL);
+    xmlFreeInputStream(inputStream);
 
 loaded:
     /*
