diff options
| author | Uwe Steinmann <steinm@php.net> | 2001-02-08 15:12:16 +0000 | 
|---|---|---|
| committer | Uwe Steinmann <steinm@php.net> | 2001-02-08 15:12:16 +0000 | 
| commit | 32b8cdde148141e923e99b718138e7558bc8ac6e (patch) | |
| tree | a49ed2356dd809f27884af775843c165753ff14f | |
| parent | df9803c75f56a83ada26727fe887b9d70e987f6a (diff) | |
| download | php-git-32b8cdde148141e923e99b718138e7558bc8ac6e.tar.gz | |
- add domxml_unlink_node(), not tested
| -rw-r--r-- | ext/domxml/php_domxml.c | 38 | ||||
| -rw-r--r-- | ext/domxml/php_domxml.h | 1 | 
2 files changed, 39 insertions, 0 deletions
| diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index b46de15bb5..db3f04ea87 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -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) diff --git a/ext/domxml/php_domxml.h b/ext/domxml/php_domxml.h index a6358adaa9..a7dc3bce66 100644 --- a/ext/domxml/php_domxml.h +++ b/ext/domxml/php_domxml.h @@ -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); | 
