]> granicus.if.org Git - php/commitdiff
- add domxml_unlink_node(), not tested
authorUwe Steinmann <steinm@php.net>
Thu, 8 Feb 2001 15:12:16 +0000 (15:12 +0000)
committerUwe Steinmann <steinm@php.net>
Thu, 8 Feb 2001 15:12:16 +0000 (15:12 +0000)
ext/domxml/php_domxml.c
ext/domxml/php_domxml.h

index b46de15bb5a1776cb1b29c86788d70772502605d..db3f04ea87bfb87629dd8bdda89cc99531e65b42 100644 (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)
index a6358adaa9dbd152f93442d3fad7108296fa358c..a7dc3bce66a1d4596a09e4b6e76480a44e0e1b50 100644 (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);