version 1.23, 2000/09/28 18:35:06
|
version 1.24, 2000/10/01 14:59:01
|
Line 1372 xmlNormalizeURIPath(char *path) {
|
Line 1372 xmlNormalizeURIPath(char *path) {
|
xmlChar * |
xmlChar * |
xmlBuildURI(const xmlChar *URI, const xmlChar *base) { |
xmlBuildURI(const xmlChar *URI, const xmlChar *base) { |
xmlChar *val = NULL; |
xmlChar *val = NULL; |
int ret, len, index, cur, out; |
int ret, ret2, len, index, cur, out; |
xmlURIPtr ref = NULL; |
xmlURIPtr ref = NULL; |
xmlURIPtr bas = NULL; |
xmlURIPtr bas = NULL; |
xmlURIPtr res = NULL; |
xmlURIPtr res = NULL; |
|
|
if ((URI == NULL) && (base == NULL)) |
|
return(NULL); |
|
if (URI == NULL) |
|
return((xmlChar *) xmlMemStrdup((const char *) base)); |
|
|
|
/* |
/* |
* 1) The URI reference is parsed into the potential four components and |
* 1) The URI reference is parsed into the potential four components and |
* fragment identifier, as described in Section 4.3. |
* fragment identifier, as described in Section 4.3. |
Line 1390 xmlBuildURI(const xmlChar *URI, const xm
|
Line 1385 xmlBuildURI(const xmlChar *URI, const xm
|
* as a reference to "." rather than as a synonym for the current |
* as a reference to "." rather than as a synonym for the current |
* URI. Should we do that here? |
* URI. Should we do that here? |
*/ |
*/ |
ref = xmlCreateURI(); |
if (URI == NULL) |
if (ref == NULL) |
ret = -1; |
goto done; |
else { |
if (*URI) { |
ref = xmlCreateURI(); |
ret = xmlParseURIReference(ref, (const char *) URI); |
if (ref == NULL) |
if (ret != 0) |
goto done; |
|
if (*URI) |
|
ret = xmlParseURIReference(ref, (const char *) URI); |
|
else |
|
ret = -1; |
|
} |
|
if (base == NULL) |
|
ret2 = -1; |
|
else { |
|
bas = xmlCreateURI(); |
|
if (bas == NULL) |
goto done; |
goto done; |
|
ret2 = xmlParseURIReference(bas, (const char *) base); |
} |
} |
bas = xmlCreateURI(); |
if ((ret != 0) && (ret2 != 0)) |
if (bas == NULL) |
|
goto done; |
goto done; |
ret = xmlParseURIReference(bas, (const char *) base); |
if (ret != 0) { |
if (ret != 0) |
/* |
|
* the base fragment must be ignored |
|
*/ |
|
if (bas->fragment != NULL) { |
|
xmlFree(bas->fragment); |
|
bas->fragment = NULL; |
|
} |
|
val = xmlSaveUri(bas); |
goto done; |
goto done; |
|
} |
|
if (ret2 != 0) { |
|
val = xmlSaveUri(ref); |
|
goto done; |
|
} |
|
|
|
|
/* |
/* |
* 2) If the path component is empty and the scheme, authority, and |
* 2) If the path component is empty and the scheme, authority, and |