* xmlCatalogListXMLResolveURI: * @catal: a catalog list * @URI: the URI * * Do a complete resolution lookup of an URI for a list of catalogs * * Implements (or tries to) 7.2. URI Resolution * from http://www.oasis-open.org/committees/entity/spec-2001-08-06.html * * Returns the URI of the resource or NULL if not found */
| 2057 | * Returns the URI of the resource or NULL if not found |
| 2058 | */ |
| 2059 | static xmlChar * |
| 2060 | xmlCatalogListXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI) { |
| 2061 | xmlChar *ret = NULL; |
| 2062 | xmlChar *urnID = NULL; |
| 2063 | |
| 2064 | if (catal == NULL) |
| 2065 | return(NULL); |
| 2066 | if (URI == NULL) |
| 2067 | return(NULL); |
| 2068 | |
| 2069 | if (!xmlStrncmp(URI, BAD_CAST XML_URN_PUBID, sizeof(XML_URN_PUBID) - 1)) { |
| 2070 | urnID = xmlCatalogUnWrapURN(URI); |
| 2071 | if (xmlDebugCatalogs) { |
| 2072 | if (urnID == NULL) |
| 2073 | fprintf(stderr, |
| 2074 | "URN ID %s expanded to NULL\n", URI); |
| 2075 | else |
| 2076 | fprintf(stderr, |
| 2077 | "URN ID expanded to %s\n", urnID); |
| 2078 | } |
| 2079 | ret = xmlCatalogListXMLResolve(catal, urnID, NULL); |
| 2080 | if (urnID != NULL) |
| 2081 | xmlFree(urnID); |
| 2082 | return(ret); |
| 2083 | } |
| 2084 | while (catal != NULL) { |
| 2085 | if (catal->type == XML_CATA_CATALOG) { |
| 2086 | if (catal->children == NULL) { |
| 2087 | xmlFetchXMLCatalogFile(catal); |
| 2088 | } |
| 2089 | if (catal->children != NULL) { |
| 2090 | ret = xmlCatalogXMLResolveURI(catal->children, URI); |
| 2091 | if (ret != NULL) |
| 2092 | return(ret); |
| 2093 | } |
| 2094 | } |
| 2095 | catal = catal->next; |
| 2096 | } |
| 2097 | return(ret); |
| 2098 | } |
| 2099 | |
| 2100 | /************************************************************************ |
| 2101 | * * |
no test coverage detected