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

Function xmlCreateIntSubset

ThirdParty/libxml2/vtklibxml2/tree.c:934–1015  ·  view source on GitHub ↗

* xmlCreateIntSubset: * @doc: the document pointer (optional) * @name: the DTD name (optional) * @ExternalID: the external (PUBLIC) ID (optional) * @SystemID: the system ID (optional) * * Create a DTD node. * * If a document is provided and it already has an internal subset, * the existing DTD object is returned without creating a new object. * If the document has no internal subset,

Source from the content-addressed store, hash-verified

932 * arguments are invalid or a memory allocation failed.
933 */
934xmlDtdPtr
935xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
936 const xmlChar *ExternalID, const xmlChar *SystemID) {
937 xmlDtdPtr cur;
938
939 if (doc != NULL) {
940 cur = xmlGetIntSubset(doc);
941 if (cur != NULL)
942 return(cur);
943 }
944
945 /*
946 * Allocate a new DTD and fill the fields.
947 */
948 cur = (xmlDtdPtr) xmlMalloc(sizeof(xmlDtd));
949 if (cur == NULL)
950 return(NULL);
951 memset(cur, 0, sizeof(xmlDtd));
952 cur->type = XML_DTD_NODE;
953
954 if (name != NULL) {
955 cur->name = xmlStrdup(name);
956 if (cur->name == NULL)
957 goto error;
958 }
959 if (ExternalID != NULL) {
960 cur->ExternalID = xmlStrdup(ExternalID);
961 if (cur->ExternalID == NULL)
962 goto error;
963 }
964 if (SystemID != NULL) {
965 cur->SystemID = xmlStrdup(SystemID);
966 if (cur->SystemID == NULL)
967 goto error;
968 }
969 if (doc != NULL) {
970 doc->intSubset = cur;
971 cur->parent = doc;
972 cur->doc = doc;
973 if (doc->children == NULL) {
974 doc->children = (xmlNodePtr) cur;
975 doc->last = (xmlNodePtr) cur;
976 } else {
977 if (doc->type == XML_HTML_DOCUMENT_NODE) {
978 xmlNodePtr prev;
979
980 prev = doc->children;
981 prev->prev = (xmlNodePtr) cur;
982 cur->next = prev;
983 doc->children = (xmlNodePtr) cur;
984 } else {
985 xmlNodePtr next;
986
987 next = doc->children;
988 while ((next != NULL) && (next->type != XML_ELEMENT_NODE))
989 next = next->next;
990 if (next == NULL) {
991 cur->prev = doc->last;

Callers 6

xmlSAX2InternalSubsetFunction · 0.85
htmlNewDocNoDtDFunction · 0.85
htmlParseDocumentFunction · 0.85
htmlParseTryOrFinishFunction · 0.85
xmlParseExternalSubsetFunction · 0.85
xmlXIncludeMergeEntitiesFunction · 0.85

Calls 3

xmlGetIntSubsetFunction · 0.85
xmlStrdupFunction · 0.85
xmlFreeDtdFunction · 0.85

Tested by

no test coverage detected