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

Function xmlAddNotationDecl

ThirdParty/libxml2/vtklibxml2/valid.c:2059–2135  ·  view source on GitHub ↗

* xmlAddNotationDecl: * @dtd: pointer to the DTD * @ctxt: the validation context * @name: the entity name * @PublicID: the public identifier or NULL * @SystemID: the system identifier or NULL * * Register a new notation declaration * * Returns NULL if not, otherwise the entity */

Source from the content-addressed store, hash-verified

2057 * Returns NULL if not, otherwise the entity
2058 */
2059xmlNotationPtr
2060xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
2061 const xmlChar *name,
2062 const xmlChar *PublicID, const xmlChar *SystemID) {
2063 xmlNotationPtr ret = NULL;
2064 xmlNotationTablePtr table;
2065 int res;
2066
2067 if (dtd == NULL) {
2068 return(NULL);
2069 }
2070 if (name == NULL) {
2071 return(NULL);
2072 }
2073 if ((PublicID == NULL) && (SystemID == NULL)) {
2074 return(NULL);
2075 }
2076
2077 /*
2078 * Create the Notation table if needed.
2079 */
2080 table = (xmlNotationTablePtr) dtd->notations;
2081 if (table == NULL) {
2082 xmlDictPtr dict = NULL;
2083 if (dtd->doc != NULL)
2084 dict = dtd->doc->dict;
2085
2086 dtd->notations = table = xmlHashCreateDict(0, dict);
2087 if (table == NULL)
2088 goto mem_error;
2089 }
2090
2091 ret = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation));
2092 if (ret == NULL)
2093 goto mem_error;
2094 memset(ret, 0, sizeof(xmlNotation));
2095
2096 /*
2097 * fill the structure.
2098 */
2099 ret->name = xmlStrdup(name);
2100 if (ret->name == NULL)
2101 goto mem_error;
2102 if (SystemID != NULL) {
2103 ret->SystemID = xmlStrdup(SystemID);
2104 if (ret->SystemID == NULL)
2105 goto mem_error;
2106 }
2107 if (PublicID != NULL) {
2108 ret->PublicID = xmlStrdup(PublicID);
2109 if (ret->PublicID == NULL)
2110 goto mem_error;
2111 }
2112
2113 /*
2114 * Validity Check:
2115 * Check the DTD for previous declarations of the ATTLIST
2116 */

Callers 1

xmlSAX2NotationDeclFunction · 0.85

Calls 5

xmlHashCreateDictFunction · 0.85
xmlStrdupFunction · 0.85
xmlHashAddFunction · 0.85
xmlFreeNotationFunction · 0.85
xmlVErrMemoryFunction · 0.85

Tested by

no test coverage detected