]> granicus.if.org Git - php/commitdiff
@- Added function domxml_node_get_content() (chregu)
authorChristian Stocker <chregu@php.net>
Fri, 18 Jan 2002 11:04:10 +0000 (11:04 +0000)
committerChristian Stocker <chregu@php.net>
Fri, 18 Jan 2002 11:04:10 +0000 (11:04 +0000)
ext/domxml/php_domxml.c
ext/domxml/php_domxml.h

index 53e2280f898c00e8e568f4d63364980769692ab1..0e41d883052f40a28cc9708044a7c19548cd13aa 100644 (file)
@@ -188,11 +188,11 @@ static zend_function_entry domxml_functions[] = {
        PHP_FE(domxml_elem_set_attribute,                                                                       NULL)
        PHP_FE(domxml_node_children,                                                                            NULL)
        PHP_FE(domxml_node_has_attributes,                                                                              NULL)
-
        PHP_FE(domxml_node_new_child,                                                                           NULL)
        PHP_FE(domxml_node,                                                                                                     NULL)
        PHP_FE(domxml_node_unlink_node,                                                                         NULL)
        PHP_FE(domxml_node_set_content,                                                                         NULL)
+       PHP_FE(domxml_node_get_content,                                                                         NULL)
        PHP_FE(domxml_new_xmldoc,                                                                                       NULL)
 
 #if defined(LIBXML_XPATH_ENABLED)
@@ -302,6 +302,7 @@ static zend_function_entry php_domxmlnode_class_functions[] = {
        PHP_FALIAS(unlink,                                      domxml_node_unlink_node,                NULL)
        PHP_FALIAS(replace_node,                                domxml_node_replace_node,                       NULL)
        PHP_FALIAS(set_content,                         domxml_node_set_content,                NULL)
+       PHP_FALIAS(get_content,                         domxml_node_get_content,                NULL)
        PHP_FALIAS(text_concat,                         domxml_node_text_concat,                NULL)
        PHP_FALIAS(set_name,                            domxml_node_set_name,                   NULL)
        PHP_FALIAS(node_name,                           domxml_node_name,                               NULL)
@@ -2025,6 +2026,30 @@ PHP_FUNCTION(domxml_node_set_content)
 }
 /* }}} */
 
+/* {{{ proto string domxml_node_get_content()
+   Gets content of a node.
+   
+   "Read the value of a node, this can be either the text carried directly by
+this node if it's a TEXT node or the aggregate string of the values carried by
+this node child's (TEXT and ENTITY_REF). Entity references are substituted."
+   */
+PHP_FUNCTION(domxml_node_get_content)
+{
+       zval *id;
+       xmlNode *nodep;
+    xmlChar *mem;
+
+    DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep);
+    mem = xmlNodeGetContent(nodep);
+    if (!mem) {
+        RETURN_FALSE;
+    }
+        
+    RETURN_STRING(mem,1);
+}
+/* }}} */
+
+
 /* End of Methods DomNode }}} */
 
 
index e58e1d3a81f61b55fde2cbdae316bfd33efadbf4..57913628b4e794933170330f9d64e49d9d60b259 100644 (file)
@@ -118,6 +118,7 @@ PHP_FUNCTION(domxml_node_unlink_node);
 PHP_FUNCTION(domxml_node_replace_node);
 PHP_FUNCTION(domxml_node_new_child);
 PHP_FUNCTION(domxml_node_set_content);
+PHP_FUNCTION(domxml_node_get_content);
 PHP_FUNCTION(domxml_node_text_concat);
 PHP_FUNCTION(domxml_node_set_name);
 PHP_FUNCTION(domxml_node_name);