* xmlACatalogAdd: * @catal: a Catalog * @type: the type of record to add to the catalog * @orig: the system, public or prefix to match * @replace: the replacement value for the match * * Add an entry in the catalog, it may overwrite existing but * different entries. * * Returns 0 if successful, -1 otherwise */
| 2920 | * Returns 0 if successful, -1 otherwise |
| 2921 | */ |
| 2922 | int |
| 2923 | xmlACatalogAdd(xmlCatalogPtr catal, const xmlChar * type, |
| 2924 | const xmlChar * orig, const xmlChar * replace) |
| 2925 | { |
| 2926 | int res = -1; |
| 2927 | |
| 2928 | if (catal == NULL) |
| 2929 | return(-1); |
| 2930 | |
| 2931 | if (catal->type == XML_XML_CATALOG_TYPE) { |
| 2932 | res = xmlAddXMLCatalog(catal->xml, type, orig, replace); |
| 2933 | } else { |
| 2934 | xmlCatalogEntryType cattype; |
| 2935 | |
| 2936 | cattype = xmlGetSGMLCatalogEntryType(type); |
| 2937 | if (cattype != XML_CATA_NONE) { |
| 2938 | xmlCatalogEntryPtr entry; |
| 2939 | |
| 2940 | entry = xmlNewCatalogEntry(cattype, orig, replace, NULL, |
| 2941 | XML_CATA_PREFER_NONE, NULL); |
| 2942 | if (catal->sgml == NULL) |
| 2943 | catal->sgml = xmlHashCreate(10); |
| 2944 | res = xmlHashAddEntry(catal->sgml, orig, entry); |
| 2945 | if (res < 0) |
| 2946 | xmlFreeCatalogEntry(entry, NULL); |
| 2947 | } |
| 2948 | } |
| 2949 | return (res); |
| 2950 | } |
| 2951 | |
| 2952 | /** |
| 2953 | * xmlACatalogRemove: |
no test coverage detected