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

Function xmlNewDtd

ThirdParty/libxml2/vtklibxml2/tree.c:848–892  ·  view source on GitHub ↗

* xmlNewDtd: * @doc: the document pointer (optional) * @name: the DTD name (optional) * @ExternalID: the external ID (optional) * @SystemID: the system ID (optional) * * Create a DTD node. * * If a document is provided, it is an error if it already has an * external subset. If the document has no external subset, it * will be set to the created DTD. * * To create an internal subset

Source from the content-addressed store, hash-verified

846 * invalid or a memory allocation failed.
847 */
848xmlDtdPtr
849xmlNewDtd(xmlDocPtr doc, const xmlChar *name,
850 const xmlChar *ExternalID, const xmlChar *SystemID) {
851 xmlDtdPtr cur;
852
853 if ((doc != NULL) && (doc->extSubset != NULL)) {
854 return(NULL);
855 }
856
857 /*
858 * Allocate a new DTD and fill the fields.
859 */
860 cur = (xmlDtdPtr) xmlMalloc(sizeof(xmlDtd));
861 if (cur == NULL)
862 return(NULL);
863 memset(cur, 0 , sizeof(xmlDtd));
864 cur->type = XML_DTD_NODE;
865
866 if (name != NULL) {
867 cur->name = xmlStrdup(name);
868 if (cur->name == NULL)
869 goto error;
870 }
871 if (ExternalID != NULL) {
872 cur->ExternalID = xmlStrdup(ExternalID);
873 if (cur->ExternalID == NULL)
874 goto error;
875 }
876 if (SystemID != NULL) {
877 cur->SystemID = xmlStrdup(SystemID);
878 if (cur->SystemID == NULL)
879 goto error;
880 }
881 if (doc != NULL)
882 doc->extSubset = cur;
883 cur->doc = doc;
884
885 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
886 xmlRegisterNodeDefaultValue((xmlNodePtr)cur);
887 return(cur);
888
889error:
890 xmlFreeDtd(cur);
891 return(NULL);
892}
893
894/**
895 * xmlGetIntSubset:

Callers 6

xmlDumpXMLCatalogFunction · 0.85
xmlSAX2ExternalSubsetFunction · 0.85
xmlCopyDtdFunction · 0.85
xmlParseEntityDeclFunction · 0.85
xmlIOParseDTDFunction · 0.85
xmlSAXParseDTDFunction · 0.85

Calls 2

xmlStrdupFunction · 0.85
xmlFreeDtdFunction · 0.85

Tested by

no test coverage detected