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

Function xmlNewDocNode

ThirdParty/libxml2/vtklibxml2/tree.c:2142–2170  ·  view source on GitHub ↗

* xmlNewDocNode: * @doc: the target document * @ns: namespace (optional) * @name: the node name * @content: text content with XML references (optional) * * Create an element node. * * If provided, @content is expected to be a valid XML attribute value * possibly containing character and entity references. Syntax errors * and references to undeclared entities are ignored silently. *

Source from the content-addressed store, hash-verified

2140 * invalid or a memory allocation failed.
2141 */
2142xmlNodePtr
2143xmlNewDocNode(xmlDocPtr doc, xmlNsPtr ns,
2144 const xmlChar *name, const xmlChar *content) {
2145 xmlNodePtr cur;
2146 xmlChar *copy;
2147
2148 if (name == NULL)
2149 return(NULL);
2150
2151 if ((doc != NULL) && (doc->dict != NULL)) {
2152 const xmlChar *dictName = xmlDictLookup(doc->dict, name, -1);
2153
2154 if (dictName == NULL)
2155 return(NULL);
2156 return(xmlNewElem(doc, ns, dictName, content));
2157 }
2158
2159 copy = xmlStrdup(name);
2160 if (copy == NULL)
2161 return(NULL);
2162
2163 cur = xmlNewElem(doc, ns, copy, content);
2164 if (cur == NULL) {
2165 xmlFree(copy);
2166 return(NULL);
2167 }
2168
2169 return(cur);
2170}
2171
2172/**
2173 * xmlNewDocNodeEatName:

Callers 12

xmlDumpXMLCatalogNodeFunction · 0.85
xmlDumpXMLCatalogFunction · 0.85
parseFileFunction · 0.85
xmlValidGetValidElementsFunction · 0.85
xmlSAX2StartElementNsFunction · 0.85
xmlNewNodeFunction · 0.85
xmlNewDocRawNodeFunction · 0.85
xmlNewChildFunction · 0.85
htmlSetMetaEncodingFunction · 0.85
xmlCtxtParseContentFunction · 0.85
xmlXIncludeIncludeNodeFunction · 0.85
xmlRelaxNGCleanupTreeFunction · 0.85

Calls 3

xmlDictLookupFunction · 0.85
xmlNewElemFunction · 0.85
xmlStrdupFunction · 0.85

Tested by

no test coverage detected