- add domxml_unlink_node(), not tested

This commit is contained in:
Uwe Steinmann 2001-02-08 15:12:16 +00:00
parent df9803c75f
commit 32b8cdde14
2 changed files with 39 additions and 0 deletions

View file

@ -69,6 +69,7 @@ static zend_function_entry domxml_functions[] = {
PHP_FE(domxml_children, NULL)
PHP_FE(domxml_new_child, NULL)
PHP_FE(domxml_node, NULL)
PHP_FE(domxml_unlink_node, NULL)
PHP_FE(domxml_set_content, NULL)
PHP_FE(domxml_new_xmldoc, NULL)
PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL)
@ -115,12 +116,15 @@ static zend_function_entry php_domxmlnode_class_functions[] = {
PHP_FALIAS(set_attribute, domxml_set_attribute, NULL)
PHP_FALIAS(attributes, domxml_attributes, NULL)
PHP_FALIAS(node, domxml_node, NULL)
PHP_FALIAS(unlink, domxml_unlink_node, NULL)
PHP_FALIAS(set_content, domxml_set_content, NULL)
{NULL, NULL, NULL}
};
#if defined(LIBXML_XPATH_ENABLED)
static zend_function_entry php_xpathctx_class_functions[] = {
PHP_FALIAS(xpath_eval, xpath_eval, NULL)
PHP_FALIAS(xpath_eval_expression, xpath_eval_expression, NULL)
{NULL, NULL, NULL}
};
@ -702,6 +706,40 @@ PHP_FUNCTION(domxml_children)
}
/* }}} */
/* {{{ proto object domxml_unlink_node([int node])
Deletes node */
PHP_FUNCTION(domxml_unlink_node)
{
zval *id, **tmp;
xmlNode *nodep, *last;
int ret;
if (ZEND_NUM_ARGS() == 0) {
id = getThis();
if (id) {
if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), (void **)&tmp) == FAILURE) {
php_error(E_WARNING, "unable to find my handle property");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(nodep,xmlNodePtr,tmp,-1, "DomNode", le_domxmlnodep)
} else {
RETURN_FALSE;
}
} else if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, &id) == FAILURE) {
WRONG_PARAM_COUNT;
} else {
if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), (void **)&tmp) == FAILURE) {
php_error(E_WARNING, "unable to find my handle property");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(nodep,xmlNodePtr,tmp,-1, "DomNode", le_domxmlnodep)
}
xmlUnlinkNode(nodep);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto string domxml_get_attribute([int node,] string attrname)
Returns value of given attribute */
PHP_FUNCTION(domxml_get_attribute)

View file

@ -55,6 +55,7 @@ PHP_FUNCTION(domxml_children);
PHP_FUNCTION(domxml_last_child);
PHP_FUNCTION(domxml_parent);
PHP_FUNCTION(domxml_node);
PHP_FUNCTION(domxml_unlink_node);
PHP_FUNCTION(domxml_new_child);
PHP_FUNCTION(domxml_set_content);