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

Function xmlNewDoc

ThirdParty/libxml2/vtklibxml2/tree.c:1092–1128  ·  view source on GitHub ↗

* xmlNewDoc: * @version: XML version string like "1.0" (optional) * * Creates a new XML document. If version is NULL, "1.0" is used. * * Returns a new document or NULL if a memory allocation failed. */

Source from the content-addressed store, hash-verified

1090 * Returns a new document or NULL if a memory allocation failed.
1091 */
1092xmlDocPtr
1093xmlNewDoc(const xmlChar *version) {
1094 xmlDocPtr cur;
1095
1096 if (version == NULL)
1097 version = (const xmlChar *) "1.0";
1098
1099 /*
1100 * Allocate a new document and fill the fields.
1101 */
1102 cur = (xmlDocPtr) xmlMalloc(sizeof(xmlDoc));
1103 if (cur == NULL)
1104 return(NULL);
1105 memset(cur, 0, sizeof(xmlDoc));
1106 cur->type = XML_DOCUMENT_NODE;
1107
1108 cur->version = xmlStrdup(version);
1109 if (cur->version == NULL) {
1110 xmlFree(cur);
1111 return(NULL);
1112 }
1113 cur->standalone = -1;
1114 cur->compression = -1; /* not initialized */
1115 cur->doc = cur;
1116 cur->parseFlags = 0;
1117 cur->properties = XML_DOC_USERBUILT;
1118 /*
1119 * The in memory encoding is always UTF8
1120 * This field will never change and would
1121 * be obsolete if not for binary compatibility.
1122 */
1123 cur->charset = XML_CHAR_ENCODING_UTF8;
1124
1125 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
1126 xmlRegisterNodeDefaultValue((xmlNodePtr)cur);
1127 return(cur);
1128}
1129
1130/**
1131 * xmlFreeDoc:

Callers 14

openFileMethod · 0.85
xmlDumpXMLCatalogFunction · 0.85
parseFileFunction · 0.85
xmlXPathObjectCopyFunction · 0.85
xmlConvertCRNGFunction · 0.85
xmlSAX2StartDocumentFunction · 0.85
xmlCopyDocFunction · 0.85
xmlParseEntityDeclFunction · 0.85
xmlParseExternalSubsetFunction · 0.85
xmlIOParseDTDFunction · 0.85
xmlSAXParseDTDFunction · 0.85
xmlNewTextWriterFunction · 0.85

Calls 1

xmlStrdupFunction · 0.85

Tested by

no test coverage detected