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

Function xmlDOMWrapCloneNode

ThirdParty/libxml2/vtklibxml2/tree.c:9241–9752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9239*/
9240
9241int
9242xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
9243 xmlDocPtr sourceDoc,
9244 xmlNodePtr node,
9245 xmlNodePtr *resNode,
9246 xmlDocPtr destDoc,
9247 xmlNodePtr destParent,
9248 int deep,
9249 int options ATTRIBUTE_UNUSED)
9250{
9251 int ret = 0;
9252 xmlNodePtr cur, cloneElem = NULL;
9253 xmlNsMapPtr nsMap = NULL;
9254 xmlNsMapItemPtr mi;
9255 xmlNsPtr ns;
9256 int depth = -1;
9257 /* int adoptStr = 1; */
9258 /* gather @parent's ns-decls. */
9259 int parnsdone = 0;
9260 /*
9261 * @ancestorsOnly:
9262 * TODO: @ancestorsOnly should be set per option.
9263 *
9264 */
9265 int ancestorsOnly = 0;
9266 xmlNodePtr resultClone = NULL, clone = NULL, parentClone = NULL, prevClone = NULL;
9267 xmlNsPtr cloneNs = NULL, *cloneNsDefSlot = NULL;
9268 xmlDictPtr dict; /* The destination dict */
9269
9270 if ((node == NULL) || (resNode == NULL) || (destDoc == NULL) ||
9271 ((destParent != NULL) && (destParent->doc != destDoc)))
9272 return(-1);
9273 /*
9274 * TODO: Initially we support only element-nodes.
9275 */
9276 if (node->type != XML_ELEMENT_NODE)
9277 return(1);
9278 /*
9279 * Check node->doc sanity.
9280 */
9281 if ((node->doc != NULL) && (sourceDoc != NULL) &&
9282 (node->doc != sourceDoc)) {
9283 /*
9284 * Might be an XIncluded node.
9285 */
9286 return (-1);
9287 }
9288 if (sourceDoc == NULL)
9289 sourceDoc = node->doc;
9290 if (sourceDoc == NULL)
9291 return (-1);
9292
9293 dict = destDoc->dict;
9294 /*
9295 * Reuse the namespace map of the context.
9296 */
9297 if (ctxt)
9298 nsMap = (xmlNsMapPtr) ctxt->namespaceMap;

Callers

nothing calls this directly

Calls 12

xmlDictLookupFunction · 0.85
xmlStrdupFunction · 0.85
xmlFreeNsFunction · 0.85
xmlStrEqualFunction · 0.85
xmlDOMWrapNsMapAddItemFunction · 0.85
xmlGetDocEntityFunction · 0.85
xmlIsIDFunction · 0.85
xmlNodeGetContentFunction · 0.85
xmlAddIDSafeFunction · 0.85
xmlDOMWrapNsMapFreeFunction · 0.85

Tested by

no test coverage detected