On Fri, Jul 04, 2008 at 02:51:52PM +0200, Wieant Nielander wrote:
> 
> >> Sorry, but how, seem to have missed that option?
> > 
> >   Whoops, now I feel stupid! I really though I had implemented it
> > when I added the flags options (ctxt->parseFlags and associated APIs),
> > that was certainly my intent, but ... it's not there. Should be rather
> > simple, just adding a new value for parsing flags (annoying, but well)
> > and test against it on line 1681.
> >   If you have a patch ready for this, sure send it along !
> > 
> >    thanks, and sorry :-)
> 
> Pas de probleme, it is exactly the patch I used and attached.
> I wasn't sure about testapi.c and runtest.c modules, so didn't
> touch them. Please let it know if you prefer different option
> names/identifiers etc.

  Okay, sorry for the delay. I reviewed the patch and it was not usable
as-is because by reordering the parser options it broke ABI
compatibility. I also changed the name of the enum option to make it
shorter: XML_PARSE_NOBASEFIX. But i kept the xmllint flag name.
Also now the Document contains the set of option it was parsed with
so we can check this when applying the XInclude.

  I end up with the following patch (without the autogenerated doc
changes)

  thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
[EMAIL PROTECTED]  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
Index: include/libxml/parser.h
===================================================================
--- include/libxml/parser.h     (revision 3773)
+++ include/libxml/parser.h     (working copy)
@@ -1093,7 +1093,8 @@ typedef enum {
     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
Index: xinclude.c
===================================================================
--- xinclude.c  (revision 3773)
+++ xinclude.c  (working copy)
@@ -1678,7 +1678,9 @@ loaded:
     /*
      * 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;
Index: xmllint.c
===================================================================
--- xmllint.c   (revision 3773)
+++ xmllint.c   (working copy)
@@ -2891,6 +2891,7 @@ static void usage(const char *name) {
 #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 @@ main(int argc, char **argv) {
            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
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to