[libxml2] * parser.c: use options from current parser context when creating



commit 798743a4983d3a2c94d6af1608bce9696aa181e7
Author: Rob Richards <rrichards cdatazone org>
Date:   Fri Jun 19 13:54:25 2009 -0400

    * parser.c: use options from current parser context when creating
      a parser context within xmlParseCtxtExternalEntity
    * xmlwriter.c: fix error message when unable to create output file

 ChangeLog   |    6 ++++++
 parser.c    |   18 +-----------------
 xmlwriter.c |    4 ++--
 3 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 014ea77..b5c0a8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Jun 19 19:51:08 CEST 2009 Rob Richards <rrichards cdatazone org>
+
+	* parser.c: use options from current parser context when creating 
+	  a parser context within xmlParseCtxtExternalEntity
+	* xmlwriter.c: fix error message when unable to create output file
+
 Thu Jun  4 11:17:23 CEST 2009 Daniel Veillard <daniel veillard com>
 
 	* c14n.c debugXML.c doc/examples/io2.c parser.c schematron.c
diff --git a/parser.c b/parser.c
index bcaec7f..f02aa1c 100644
--- a/parser.c
+++ b/parser.c
@@ -12068,27 +12068,11 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
     if (ctx->myDoc == NULL) /* @@ relax but check for dereferences */
 	return(-1);
 
-    ctxt = xmlNewParserCtxt();
+    ctxt = xmlCreateEntityParserCtxtInternal(URL, ID, NULL, ctx);
     if (ctxt == NULL) {
 	return(-1);
     }
 
-    ctxt->userData = ctxt;
-    ctxt->_private = ctx->_private;
-
-    inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt);
-    if (inputStream == NULL) {
-	xmlFreeParserCtxt(ctxt);
-	return(-1);
-    }
-
-    inputPush(ctxt, inputStream);
-
-    if ((ctxt->directory == NULL) && (directory == NULL))
-	directory = xmlParserGetDirectory((char *)URL);
-    if ((ctxt->directory == NULL) && (directory != NULL))
-	ctxt->directory = directory;
-
     oldsax = ctxt->sax;
     ctxt->sax = ctx->sax;
     xmlDetectSAX2(ctxt);
diff --git a/xmlwriter.c b/xmlwriter.c
index ec3231f..11b15e0 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -242,8 +242,8 @@ xmlNewTextWriterFilename(const char *uri, int compression)
 
     out = xmlOutputBufferCreateFilename(uri, NULL, compression);
     if (out == NULL) {
-        xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
-                        "xmlNewTextWriterFilename : out of memory!\n");
+        xmlWriterErrMsg(NULL, XML_IO_EIO,
+                        "xmlNewTextWriterFilename : cannot open uri\n");
         return NULL;
     }
 



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