MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlExpandCatalog

Function xmlExpandCatalog

ThirdParty/libxml2/vtklibxml2/catalog.c:2699–2735  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

2697 * Returns 0 in case of success, -1 in case of error
2698 */
2699static int
2700xmlExpandCatalog(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:

Callers 2

xmlParseSGMLCatalogFunction · 0.85
xmlLoadCatalogFunction · 0.85

Calls 2

xmlLoadFileContentFunction · 0.85
xmlParseSGMLCatalogFunction · 0.85

Tested by

no test coverage detected