After using setAttributes ($xml->setAttributes("/users[1]/Nodename[1]",array("atr1","atr2"));) I get the following incorrect result:
<Nodename 0="atr1" 1="atr2"/>
Where do the 0 and 1 come from?
Oliver
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: woensdag 26 september 2001 10:02
To: [EMAIL PROTECTED]
Subject: [phpXML] Bug in setAttributes
Hi,
just patched phpxml 1.N.5:
// OLD --------------------------------------------------
function setAttributes($absoluteXPath, $attribute) {
// The attributes parameter should be an associative array.
if (!is_array($attributes)) return;
// Add the attributes to the node.
if (isSet($this->nodes[$path]['attributes'])) {
$this->nodes[$path]['attributes'] =
array_merge($this->nodes[$path]['attributes'], $attributes);
} else {
$this->nodes[$path]['attributes'] = $attributes;
}
}
Tell me where the $path variableis set and why the parameter
$attribute
is called $attributes in the function...
// NEW --------------------------------------------------
function setAttributes($absoluteXPath, $attributes) {
// The attributes parameter should be an associative array.
if (!is_array($attributes)) return;
// Add the attributes to the node.
if (isSet($this->nodes[$absoluteXPath]['attributes'])) {
$this->nodes[$absoluteXPath]['attributes'] =
array_merge($this->nodes [$absoluteXPath]['attributes'],
$attributes);
} else {
$this->nodes[$absoluteXPath]['attributes'] = $attributes;
}
}
BTW, did anyone check the code before releasing it?
How else could one miss those bugs like the
"$this ->" thing and the setAttributes-function,
that did not work at all.
CU, Axel
--
[EMAIL PROTECTED]
PS, soory for my bad english...
--
This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https:[EMAIL PROTECTED]/