* xmlSetListDoc: * @list: a node list * @doc: new document * * Associate all subtrees in @list with a new document. * * Internal function, see xmlSetTreeDoc. * * Returns 0 on success. If a memory allocation fails, returns -1. * All subtrees will be updated on failure but some strings * may be lost. */
| 2923 | * may be lost. |
| 2924 | */ |
| 2925 | int |
| 2926 | xmlSetListDoc(xmlNodePtr list, xmlDocPtr doc) { |
| 2927 | xmlNodePtr cur; |
| 2928 | int ret = 0; |
| 2929 | |
| 2930 | if ((list == NULL) || (list->type == XML_NAMESPACE_DECL)) |
| 2931 | return(0); |
| 2932 | |
| 2933 | cur = list; |
| 2934 | while (cur != NULL) { |
| 2935 | if (cur->doc != doc) { |
| 2936 | if (xmlSetTreeDoc(cur, doc) < 0) |
| 2937 | ret = -1; |
| 2938 | } |
| 2939 | cur = cur->next; |
| 2940 | } |
| 2941 | |
| 2942 | return(ret); |
| 2943 | } |
| 2944 | |
| 2945 | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) |
| 2946 | /** |
no test coverage detected