Re[4]: [xml] xmlNodeGetContent() bug?



Hello Christian,

 Glad to see Christian in this list, hope we will finally get properly
working DOM XML extension for PHP some days :)

 The only reason, why i decide to submit this report into this list
and not at http://bugs.php.net is this piece of DOM XML extension
source from PHP distribution:

/* {{{ 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;
        }

        RETVAL_STRING(mem,1);
        xmlFree(mem);
}
/* }}} */

 Since (as i wrote before) this function (implementation of
get_content() method, i've used in my testcase) have nothing more then
call of xmlNodeGetContent() i thought that this report is more
relevant to xmlNodeGetContent() function, rather then this one.

 However after more testing it looks like problem is not with libxml2,
but with DOM XML extension of PHP. Take a look at this example:

<?php
$xml = domxml_open_mem('<?xml version="1.0"?><!DOCTYPE root [<!ENTITY test "some 
text">]><root>&lt;text_1&test;text_2&gt;</root>');
$root = $xml->root();
echo $xml->dump_node($root)."\n";
echo $root->get_content()."\n";
?>

 It returns expected results:

<root>&lt;text_1&test;text_2&gt;</root>
<text_1some texttext_2>
 
 So problem is somewhere in dynamic DOM tree construction methods.
 

Friday, June 13, 2003, 11:42:13 AM, you wrote:

CS> On Thu, 2003-06-12 at 22:57, Daniel Veillard wrote:
On Thu, Jun 12, 2003 at 09:27:01PM +0400, Alexander Grimalovsky wrote:
$root->append_child($xml->create_entity_reference('&test;'));

  I have NO idea how the PHP binding is done. Provide a Python example
and we will see if I find a problem. So far I *never* got any feedback
or questions from the people doing that binding. All I get is bug reports
about it.

CS> This is not really true ;) There are mails from the php binding
CS> maintainers (me and some others) on this mailinglist.

CS> But you're right, this bug (if it's a bug at all) should be filled on
CS> http://bugs.php.net

CS> Furthermore, the current php binding (as of PHP 4.3) is going through a
CS> complete rewrite and should much more adhere to the standards (this is
CS> just an information to the PHP heads out there...)

CS> chregu


   create_entity_reference('&lt;')
 also looks more than suspicious to me. are you trying to create
an entity reference to the entity whose name is "&lt;", shouldn't
that be "lt", moreover all 5 predefined entities never generate
entities references in the tree.
  In all honnesty, You're dropping code at us, that code base is not
directly related to the code we maintain, and seems to have only very
few attention or debugging. The issues I pointed in my mails about
your code samples are really basic, anybody trying to debug this should
have gone though them, so please do your homework too. Now if this break
with the python bindings then I may debug it. I would appreciate if
you could follow the general guidelines from http://xmlsoft.org/bugs.html

Daniel



-- 
Best regards,
 Flying                            mailto:flying dom natm ru





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]