enhanced xmlBuildRelativeURI to allow the URI and the base to be in
* uri.c: enhanced xmlBuildRelativeURI to allow the URI and the
base to be in "relative" form
diff --git a/ChangeLog b/ChangeLog
index 20bd0e3..0c962aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jul 25 11:41:18 PDT 2005 William Brack <wbrack@mmm.com.hk>
+
+ * uri.c: enhanced xmlBuildRelativeURI to allow the URI and the
+ base to be in "relative" form
+
Sun Jul 24 10:25:41 EDT 2005 Daniel Veillard <daniel@veillard.com>
* schematron.c xmllint.c: started adding schematron to the xmllint
diff --git a/uri.c b/uri.c
index d2fa521..1fdbaf8 100644
--- a/uri.c
+++ b/uri.c
@@ -2070,14 +2070,6 @@
if ((URI == NULL) || (*URI == 0))
return NULL;
- /*
- * Special case - if URI starts with '.', we assume it's already
- * in relative form, so nothing to do.
- */
- if (*URI == '.') {
- val = xmlStrdup (URI);
- goto done;
- }
/*
* First parse URI into a standard form
@@ -2085,9 +2077,13 @@
ref = xmlCreateURI ();
if (ref == NULL)
return NULL;
- ret = xmlParseURIReference (ref, (const char *) URI);
- if (ret != 0)
- goto done; /* Error in URI, return NULL */
+ /* If URI not already in "relative" form */
+ if (URI[0] != '.') {
+ ret = xmlParseURIReference (ref, (const char *) URI);
+ if (ret != 0)
+ goto done; /* Error in URI, return NULL */
+ } else
+ ref->path = (char *)xmlStrdup(URI);
/*
* Next parse base into the same standard form
@@ -2099,9 +2095,12 @@
bas = xmlCreateURI ();
if (bas == NULL)
goto done;
- ret = xmlParseURIReference (bas, (const char *) base);
- if (ret != 0)
- goto done; /* Error in base, return NULL */
+ if (base[0] != '.') {
+ ret = xmlParseURIReference (bas, (const char *) base);
+ if (ret != 0)
+ goto done; /* Error in base, return NULL */
+ } else
+ bas->path = (char *)xmlStrdup(base);
/*
* If the scheme / server on the URI differs from the base,