libxml2 r3775 - in trunk: . include/libxml



Author: veillard
Date: Tue Aug 26 07:26:55 2008
New Revision: 3775
URL: http://svn.gnome.org/viewvc/libxml2?rev=3775&view=rev

Log:
* include/libxml/parser.h xinclude.c xmllint.c: patch based on
  Wieant Nielander contribution to add the option of not doing
  URI base fixup in XInclude
Daniel


Modified:
   trunk/ChangeLog
   trunk/include/libxml/parser.h
   trunk/xinclude.c
   trunk/xmllint.c

Modified: trunk/include/libxml/parser.h
==============================================================================
--- trunk/include/libxml/parser.h	(original)
+++ trunk/include/libxml/parser.h	Tue Aug 26 07:26:55 2008
@@ -1093,7 +1093,8 @@
     XML_PARSE_COMPACT   = 1<<16,/* compact small text nodes; no modification of
                                    the tree allowed afterwards (will possibly
 				   crash if you try to modify the tree) */
-    XML_PARSE_OLD10	= 1<<17 /* parse using XML-1.0 before update 5 */
+    XML_PARSE_OLD10	= 1<<17,/* parse using XML-1.0 before update 5 */
+    XML_PARSE_NOBASEFIX = 1<<18 /* do not fixup XINCLUDE xml:base uris */
 } xmlParserOption;
 
 XMLPUBFUN void XMLCALL

Modified: trunk/xinclude.c
==============================================================================
--- trunk/xinclude.c	(original)
+++ trunk/xinclude.c	Tue Aug 26 07:26:55 2008
@@ -1678,7 +1678,9 @@
     /*
      * Do the xml:base fixup if needed
      */
-    if ((doc != NULL) && (URL != NULL) && (xmlStrchr(URL, (xmlChar) '/'))) {
+    if ((doc != NULL) && (URL != NULL) && (xmlStrchr(URL, (xmlChar) '/')) &&
+        (!(ctxt->parseFlags & XML_PARSE_NOBASEFIX)) &&
+	(!(doc->parseFlags & XML_PARSE_NOBASEFIX))) {
 	xmlNodePtr node;
 	xmlChar *base;
 	xmlChar *curBase;

Modified: trunk/xmllint.c
==============================================================================
--- trunk/xmllint.c	(original)
+++ trunk/xmllint.c	Tue Aug 26 07:26:55 2008
@@ -2891,6 +2891,7 @@
 #ifdef LIBXML_XINCLUDE_ENABLED
     printf("\t--xinclude : do XInclude processing\n");
     printf("\t--noxincludenode : same but do not generate XInclude nodes\n");
+    printf("\t--nofixup-base-uris : do not fixup xml:base uris\n");
 #endif
     printf("\t--loaddtd : fetch external DTD\n");
     printf("\t--dtdattr : loaddtd + populate the tree with inherited attributes \n");
@@ -3093,6 +3094,12 @@
 	    options |= XML_PARSE_XINCLUDE;
 	    options |= XML_PARSE_NOXINCNODE;
 	}
+	else if ((!strcmp(argv[i], "-nofixup-base-uris")) ||
+	         (!strcmp(argv[i], "--nofixup-base-uris"))) {
+	    xinclude++;
+	    options |= XML_PARSE_XINCLUDE;
+	    options |= XML_PARSE_NOBASEFIX;
+	}
 #endif
 #ifdef LIBXML_OUTPUT_ENABLED
 #ifdef HAVE_ZLIB_H



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