* xmlExpandCatalog: * @catal: a catalog * @filename: a file path * * Load the catalog and expand the existing catal structure. * This can be either an XML Catalog or an SGML Catalog * * Returns 0 in case of success, -1 in case of error */
| 2697 | * Returns 0 in case of success, -1 in case of error |
| 2698 | */ |
| 2699 | static int |
| 2700 | xmlExpandCatalog(xmlCatalogPtr catal, const char *filename) |
| 2701 | { |
| 2702 | int ret; |
| 2703 | |
| 2704 | if ((catal == NULL) || (filename == NULL)) |
| 2705 | return(-1); |
| 2706 | |
| 2707 | |
| 2708 | if (catal->type == XML_SGML_CATALOG_TYPE) { |
| 2709 | xmlChar *content; |
| 2710 | |
| 2711 | content = xmlLoadFileContent(filename); |
| 2712 | if (content == NULL) |
| 2713 | return(-1); |
| 2714 | |
| 2715 | ret = xmlParseSGMLCatalog(catal, content, filename, 0); |
| 2716 | if (ret < 0) { |
| 2717 | xmlFree(content); |
| 2718 | return(-1); |
| 2719 | } |
| 2720 | xmlFree(content); |
| 2721 | } else { |
| 2722 | xmlCatalogEntryPtr tmp, cur; |
| 2723 | tmp = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL, |
| 2724 | NULL, BAD_CAST filename, xmlCatalogDefaultPrefer, NULL); |
| 2725 | |
| 2726 | cur = catal->xml; |
| 2727 | if (cur == NULL) { |
| 2728 | catal->xml = tmp; |
| 2729 | } else { |
| 2730 | while (cur->next != NULL) cur = cur->next; |
| 2731 | cur->next = tmp; |
| 2732 | } |
| 2733 | } |
| 2734 | return (0); |
| 2735 | } |
| 2736 | |
| 2737 | /** |
| 2738 | * xmlACatalogResolveSystem: |
no test coverage detected