cvs: php4 /ext/dom text.c

From: Date: Wed, 11 Jun 2003 19:55:52 +0000
Subject: cvs: php4 /ext/dom text.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-21623@lists.php.net to get a copy of this message
rrichards Wed Jun 11 15:55:52 2003 EDT Modified files: /php4/ext/dom text.c Log: add isWhitespaceInElementContent() fix splitText for nodes not in tree correct links to specs Index: php4/ext/dom/text.c diff -u php4/ext/dom/text.c:1.6 php4/ext/dom/text.c:1.7 --- php4/ext/dom/text.c:1.6 Tue Jun 10 18:24:54 2003 +++ php4/ext/dom/text.c Wed Jun 11 15:55:52 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: text.c,v 1.6 2003/06/10 22:24:54 rrichards Exp $ */ +/* $Id: text.c,v 1.7 2003/06/11 19:55:52 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -76,7 +76,7 @@ /* {{{ proto wholeText string readonly=yes -URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Text3-wholeText +URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-wholeText Since: DOM Level 3 */ int dom_text_whole_text_read(dom_object *obj, zval **retval TSRMLS_DC) @@ -98,10 +98,8 @@ /* }}} */ - - /* {{{ proto domtext dom_text_split_text(unsigned long offset); -URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-38853C1D +URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D Since: */ PHP_FUNCTION(dom_text_split_text) @@ -148,9 +146,11 @@ xmlFree(first); xmlFree(second); - nnode->type = XML_ELEMENT_NODE; - xmlAddNextSibling(node, nnode); - nnode->type = XML_TEXT_NODE; + if (node->parent != NULL) { + nnode->type = XML_ELEMENT_NODE; + xmlAddNextSibling(node, nnode); + nnode->type = XML_TEXT_NODE; + } return_value = php_dom_create_object(nnode, &ret, NULL, return_value, intern TSRMLS_CC); } @@ -158,18 +158,29 @@ /* {{{ proto boolean dom_text_is_whitespace_in_element_content(); -URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Text3-isWhitespaceInElementContent +URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent Since: DOM Level 3 */ PHP_FUNCTION(dom_text_is_whitespace_in_element_content) { - DOM_NOT_IMPLEMENTED(); + xmlNodePtr node; + dom_object *intern; + + DOM_GET_THIS_OBJ(node, getThis(), xmlNodePtr, intern); + + DOM_NO_ARGS(); + + if (xmlIsBlankNode(node)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } } /* }}} end dom_text_is_whitespace_in_element_content */ /* {{{ proto domtext dom_text_replace_whole_text(string content); -URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Text3-replaceWholeText +URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText Since: DOM Level 3 */ PHP_FUNCTION(dom_text_replace_whole_text)

« previous php.cvs (#21623) next »