* xmlNewDocNodeEatName: * @doc: the target document * @ns: namespace (optional) * @name: the node name * @content: text content with XML references (optional) * * Create an element node. * * Like xmlNewDocNode, but the @name string will be used directly * without making a copy. Takes ownership of @name which will also * be freed on error. * * Returns a pointer to the new node objec
| 2186 | * invalid or a memory allocation failed. |
| 2187 | */ |
| 2188 | xmlNodePtr |
| 2189 | xmlNewDocNodeEatName(xmlDocPtr doc, xmlNsPtr ns, |
| 2190 | xmlChar *name, const xmlChar *content) { |
| 2191 | xmlNodePtr cur; |
| 2192 | |
| 2193 | if (name == NULL) |
| 2194 | return(NULL); |
| 2195 | |
| 2196 | cur = xmlNewElem(doc, ns, name, content); |
| 2197 | if (cur == NULL) { |
| 2198 | /* if name doesn't come from the doc dictionary free it here */ |
| 2199 | if ((doc == NULL) || |
| 2200 | (doc->dict == NULL) || |
| 2201 | (!xmlDictOwns(doc->dict, name))) |
| 2202 | xmlFree(name); |
| 2203 | return(NULL); |
| 2204 | } |
| 2205 | |
| 2206 | return(cur); |
| 2207 | } |
| 2208 | |
| 2209 | #ifdef LIBXML_TREE_ENABLED |
| 2210 | /** |
no test coverage detected