examples/libxml.c
hubbub_error reparent_children(void *ctx, void *node, void *new_parent)
{
	xmlNode *n = (xmlNode *) node;
	xmlNode *p = (xmlNode *) new_parent;
	xmlNode *child;

	for (child = n->children; child != NULL; ) {
		xmlNode *next = child->next;

		xmlUnlinkNode(child);

		if (xmlAddChild(p, child) == NULL)
			return HUBBUB_NOMEM;

		child = next;
	}

	return HUBBUB_OK;
}
/**
 * Move all the children of one node to another
 *
 * \param ctx         Our context
 * \param node        The initial parent node
 * \param new_parent  The new parent node
 * \return HUBBUB_OK on success, appropriate error otherwise
 */
Move all the children of one node to another
\param ctx         Our context
\param node        The initial parent node
\param new_parent  The new parent node
\return HUBBUB_OK on success, appropriate error otherwise
Move all the children of one node to another \ param ctx Our context \ param node The initial parent node \ param new_parent The new parent node \ return HUBBUB_OK on success appropriate error otherwise
hubbub_error reparent_children(void *ctx, void *node, void *new_parent)
{
	xmlNode *n = (xmlNode *) node;
	xmlNode *p = (xmlNode *) new_parent;
	xmlNode *child;
	for (child = n->children; child != NULL; ) {
		xmlNode *next = child->next;
		xmlUnlinkNode(child);
		if (xmlAddChild(p, child) == NULL)
			return HUBBUB_NOMEM;
		child = next;
	}
	return HUBBUB_OK;
}
hubbub_error reparent_children ( void * ctx , void * node , void * new_parent ) { xmlNode * n = ( xmlNode * ) node ; xmlNode * p = ( xmlNode * ) new_parent ; xmlNode * child ; for ( child = n -> children ; child != NULL ; ) { xmlNode * next = child -> next ; xmlUnlinkNode ( child ) ; if ( xmlAddChild ( p , child ) == NULL ) return HUBBUB_NOMEM ; child = next ; } return HUBBUB_OK ; }
Move all the children of one node to another
 \param ctx         Our context
 \param node        The initial parent node
 \param new_parent  The new parent node
 \return HUBBUB_OK on success, appropriate error otherwise
Move all the children of one node to another \ param ctx Our context \ param node The initial parent node \ param new_parent The new parent node \ return HUBBUB_OK on success appropriate error otherwise