* xmlRemoveProp: * @cur: an attribute * * Unlink and free an attribute including all children. * * Note this doesn't work for namespace declarations. * * The attribute must have a non-NULL parent pointer. * * Returns 0 on success or -1 if the attribute was not found or * arguments are invalid. */
| 1950 | * arguments are invalid. |
| 1951 | */ |
| 1952 | int |
| 1953 | xmlRemoveProp(xmlAttrPtr cur) { |
| 1954 | xmlAttrPtr tmp; |
| 1955 | if (cur == NULL) { |
| 1956 | return(-1); |
| 1957 | } |
| 1958 | if (cur->parent == NULL) { |
| 1959 | return(-1); |
| 1960 | } |
| 1961 | tmp = cur->parent->properties; |
| 1962 | if (tmp == cur) { |
| 1963 | cur->parent->properties = cur->next; |
| 1964 | if (cur->next != NULL) |
| 1965 | cur->next->prev = NULL; |
| 1966 | xmlFreeProp(cur); |
| 1967 | return(0); |
| 1968 | } |
| 1969 | while (tmp != NULL) { |
| 1970 | if (tmp->next == cur) { |
| 1971 | tmp->next = cur->next; |
| 1972 | if (tmp->next != NULL) |
| 1973 | tmp->next->prev = tmp; |
| 1974 | xmlFreeProp(cur); |
| 1975 | return(0); |
| 1976 | } |
| 1977 | tmp = tmp->next; |
| 1978 | } |
| 1979 | return(-1); |
| 1980 | } |
| 1981 | |
| 1982 | /** |
| 1983 | * xmlNewDocPI: |
no test coverage detected