* xmlAddPrevSibling: * @next: the target node * @cur: the new node * * Unlinks @cur and inserts it as previous sibling before @next. * * Unlike xmlAddChild this function does not merge text nodes. * * If @cur is an attribute node, it is inserted before attribute * @next. If the attribute list contains an attribute with a name * matching @cur, the old attribute is destroyed. * * See t
| 3220 | * if arguments are invalid or a memory allocation failed. |
| 3221 | */ |
| 3222 | xmlNodePtr |
| 3223 | xmlAddPrevSibling(xmlNodePtr next, xmlNodePtr cur) { |
| 3224 | if ((next == NULL) || (next->type == XML_NAMESPACE_DECL) || |
| 3225 | (cur == NULL) || (cur->type == XML_NAMESPACE_DECL) || |
| 3226 | (cur == next)) |
| 3227 | return(NULL); |
| 3228 | |
| 3229 | if (cur == next->prev) |
| 3230 | return(cur); |
| 3231 | |
| 3232 | return(xmlInsertNode(next->doc, cur, next->parent, next->prev, next, 0)); |
| 3233 | } |
| 3234 | #endif /* LIBXML_TREE_ENABLED */ |
| 3235 | |
| 3236 | /** |
no test coverage detected