Re[2]: [xml] bug with created attribute nodes?

Hello Daniel,

 Please take a look at the difference between your and my testcases:

root.setProp("img", "a&b")


 Except syntax there is also different values set for attributes. With
your value, being set in PHP i will get same result as you, but try
to set exactly same attribute value as i do. If you will get different
result with it - i will switch to PHP developers :)

Monday, December 23, 2002, 8:18:08 PM, you wrote:

DV> On Mon, Dec 23, 2002 at 08:07:08PM +0300, Alexander Grimalovsky wrote:
 It looks like there is a bug in libxml2 with handling pre-defined (or
numeric) entities while creating attribute nodes.
 Since i'm using libxml2 through PHP i can't give you proper testcase,
but maybe this one will also be useful for you:

$xml = domxml_open_mem('<'.'?xml version="1.0"?'.'><root/>');
$root = $xml->root();
echo $xml->dump_mem();

 This testcase produces following result:
<?xml version="1.0"?>
<root a="a&amp;#222;b"/>

 while it is expected to be:
<?xml version="1.0"?>
<root a="a&#222;b"/>

Internally set_attribute() method calls xmlSetProp() function which
seems to be buggy because it contains:

DV>  Ask the PHP bindings maintainer I have no idea what's going on on their
DV> side !

paphio:~ ->> python
DV> Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
DV> [GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2
DV> Type "help", "copyright", "credits" or "license" for more information.
import libxml2
doc = libxml2.parseDoc("""<doc/>""")
root = doc.getRootElement()
root.setProp("img", "a&b")
DV> <xmlAttr (img) object at 0x84943dc>
DV> '<doc img="a&amp;b"/>'

DV>   I do not maintain the PHP bindings, I have no idea how reliable they
DV> are or aren't,

DV> Daniel

Best regards,
 Flying                            mailto:flying dom natm ru

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