implemented the XML_PARSE_NONET parser option. converted xmllint.c to use
* parser.c xmlIO.c include/libxml/parserInternals.h: implemented
the XML_PARSE_NONET parser option.
* xmllint.c: converted xmllint.c to use the option instead of
relying on the global resolver variable.
Daniel
diff --git a/parser.c b/parser.c
index 7680e3a..ff58294 100644
--- a/parser.c
+++ b/parser.c
@@ -11433,17 +11433,18 @@
************************************************************************/
/**
- * xmlCreateFileParserCtxt:
- * @filename: the filename
+ * xmlCreateURLParserCtxt:
+ * @filename: the filename or URL
+ * @options: a combination of xmlParserOption(s)
*
- * Create a parser context for a file content.
+ * Create a parser context for a file or URL content.
* Automatic support for ZLIB/Compress compressed document is provided
- * by default if found at compile-time.
+ * by default if found at compile-time and for file accesses
*
* Returns the new parser context or NULL
*/
xmlParserCtxtPtr
-xmlCreateFileParserCtxt(const char *filename)
+xmlCreateURLParserCtxt(const char *filename, int options)
{
xmlParserCtxtPtr ctxt;
xmlParserInputPtr inputStream;
@@ -11455,6 +11456,8 @@
return(NULL);
}
+ if (options != 0)
+ xmlCtxtUseOptions(ctxt, options);
inputStream = xmlLoadExternalEntity(filename, NULL, ctxt);
if (inputStream == NULL) {
@@ -11471,6 +11474,22 @@
return(ctxt);
}
+/**
+ * xmlCreateFileParserCtxt:
+ * @filename: the filename
+ *
+ * Create a parser context for a file content.
+ * Automatic support for ZLIB/Compress compressed document is provided
+ * by default if found at compile-time.
+ *
+ * Returns the new parser context or NULL
+ */
+xmlParserCtxtPtr
+xmlCreateFileParserCtxt(const char *filename)
+{
+ return(xmlCreateURLParserCtxt(filename, 0));
+}
+
#ifdef LIBXML_SAX1_ENABLED
/**
* xmlSAXParseFileWithData:
@@ -12385,6 +12404,10 @@
ctxt->options |= XML_PARSE_NSCLEAN;
options -= XML_PARSE_NSCLEAN;
}
+ if (options & XML_PARSE_NONET) {
+ ctxt->options |= XML_PARSE_NONET;
+ options -= XML_PARSE_NONET;
+ }
ctxt->linenumbers = 1;
return (options);
}
@@ -12488,7 +12511,7 @@
{
xmlParserCtxtPtr ctxt;
- ctxt = xmlCreateFileParserCtxt(filename);
+ ctxt = xmlCreateURLParserCtxt(filename, options);
if (ctxt == NULL)
return (NULL);
return (xmlDoRead(ctxt, NULL, encoding, options, 0));