Re: [xml] bug with created attribute nodes?

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:

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

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

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


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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