[xml] bug with created attribute nodes?
- From: Alexander Grimalovsky <flying dom natm ru>
- To: xml gnome org
- Subject: [xml] bug with created attribute nodes?
- Date: Mon, 23 Dec 2002 20:07:08 +0300
Hello,
I have send this message about 5 days ago, but there was no any
response to it (maybe it was not arrived into mailing list?) so i
decide to post it again because this issue is critical for our
application.
Sorry for this double posting.
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:
<?php
$xml = domxml_open_mem('<'.'?xml version="1.0"?'.'><root/>');
$root = $xml->root();
$root->set_attribute('a','a&b');
echo $xml->dump_mem();
?>
This testcase produces following result:
<?xml version="1.0"?>
<root a="a&#222;b"/>
while it is expected to be:
<?xml version="1.0"?>
<root a="aÞb"/>
Internally set_attribute() method calls xmlSetProp() function which
seems to be buggy because it contains:
buffer = xmlEncodeEntitiesReentrant(node->doc, value);
prop->children = xmlStringGetNodeList(node->doc, buffer);
As you may see - when you put pre-defined or numeric entity into
attribute - it is first quoted and only then parsed for entities and
it gives such behaviour. In other hand just loading such document in
libxml2 (for example through xmllint) gives correct output.
PS: I've tested it with libxml2 2.4.21 but there seems to be nothing in
ChangeLog about such thing.
--
Best regards,
Alexander mailto:flying dom natm ru
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]