xinclude with parse="text" does not use the entity loader

For https://bugzilla.gnome.org/show_bug.cgi?id=552479

The code for xinclude parse="text" was not using the registered
entity loader, defeating attempts to control loading of files.
diff --git a/xinclude.c b/xinclude.c
index 2916ffa..d01f978 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -1796,6 +1796,8 @@
     int i;
     xmlChar *encoding = NULL;
     xmlCharEncoding enc = (xmlCharEncoding) 0;
+    xmlParserCtxtPtr pctxt;
+    xmlParserInputPtr inputStream;
 
     /*
      * Check the URL and remove any fragment identifier
@@ -1870,11 +1872,23 @@
     /*
      * Load it.
      */
-    buf = xmlParserInputBufferCreateFilename((const char *)URL, enc);
-    if (buf == NULL) {
+    pctxt = xmlNewParserCtxt();
+    inputStream = xmlLoadExternalEntity((const char*)URL, NULL, pctxt);
+    if(inputStream == NULL) {
+	xmlFreeParserCtxt(pctxt);
 	xmlFree(URL);
 	return(-1);
     }
+    buf = inputStream->buf;
+    if (buf == NULL) {
+	xmlFreeInputStream (inputStream);
+	xmlFreeParserCtxt(pctxt);
+	xmlFree(URL);
+	return(-1);
+    }
+    if (buf->encoder)
+	xmlCharEncCloseFunc(buf->encoder);
+    buf->encoder = xmlGetCharEncodingHandler(enc);
     node = xmlNewText(NULL);
 
     /*
@@ -1905,8 +1919,9 @@
 	}
 	xmlBufferShrink(buf->buffer, len);
     }
-    xmlFreeParserInputBuffer(buf);
+    xmlFreeParserCtxt(pctxt);
     xmlXIncludeAddTxt(ctxt, node, URL);
+    xmlFreeInputStream(inputStream);
 
 loaded:
     /*