domxml & Entity Ref Nodes

From: Date: Sun, 24 Feb 2002 20:58:34 +0000
Subject: domxml & Entity Ref Nodes
Groups: php.dev 
Request: Send a blank email to php-dev+get-80351@lists.php.net to get a copy of this message
Greetings. I discovered in domxml, that when using 'children' on an entity reference node, the array returned is for the appropriate entity, plus all entities after it in libxml's internal list of entities. The patch below fixes this problem (but not too elegantly; if someone wants to override 'children' instead, feel free...) -- -Jonathan P Springer <jonathan.springer@verizon.net> ------------------------------------------------------------------------------ "A standard is an arbitrary solution to a recurring problem." - Joe Hazen Index: ext/domxml/php_domxml.c =================================================================== RCS file: /repository/php4/ext/domxml/php_domxml.c,v retrieving revision 1.117 diff -u -c -r1.117 php_domxml.c cvs server: conflicting specifications of output style *** ext/domxml/php_domxml.c 20 Feb 2002 23:35:20 -0000 1.117 --- ext/domxml/php_domxml.c 24 Feb 2002 20:55:20 -0000 *************** *** 984,989 **** --- 984,990 ---- xmlNodePtr nodep = obj; object_init_ex(wrapper, domxmlentityref_class_entry); rsrc_type = le_domxmlentityrefp; + add_property_long(wrapper, "type", Z_TYPE_P(nodep)); add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1); break; } *************** *** 1787,1792 **** --- 1788,1796 ---- child = php_domobject_new(last, &ret TSRMLS_CC); add_next_index_zval(return_value, child); last = last->next; + + /* TRICKY: For entity refs, we only want to assign one */ + if ((Z_TYPE_P(nodep) == XML_ENTITY_REF_NODE)) break; } } /* }}} */

« previous php.dev (#80351) next »