I have noticed two errors in the functions listed above. In the replaceData, if the path is
/root[1]/node[1]/attribute::title the "Numpty" check stops the _setContent from being executed, even though _setContent can handle that xpath...so this seems to be a mistake. Secondly, in the _setContent function, there is one missing & that would enable the reference to the node array to work...Here is a snippet: <OldCode> if (ereg('/attribute::', $absoluteXPath)) { // Get the path to the attribute node's parent. $thePath = $this->_prestr($absoluteXPath, '/attribute::'); // Get the parent node. $node = $this->nodes[$thePath]; // Get the name of the attribute. $attribute = $this->_afterstr($absoluteXPath, '/attribute::'); // Get a reference to the string that we can then modify $tmp = &$node['attributes'][$attribute]; // Set the attribute if (!isSet($tmp)) $tmp=''; //$this->nodes[$thePath]['attributes'][$attribute] = $append ? $tmp . $value : $value; $tmp = $append ? $tmp . $value : $value; } else { </OldCode> <NewCode> if (ereg('/attribute::', $absoluteXPath)) { // Get the path to the attribute node's parent. $thePath = $this->_prestr($absoluteXPath, '/attribute::'); // Get the parent node. $node = &$this->nodes[$thePath]; --------------^ // Get the name of the attribute. $attribute = $this->_afterstr($absoluteXPath, '/attribute::'); // Get a reference to the string that we can then modify $tmp = &$node['attributes'][$attribute]; // Set the attribute if (!isSet($tmp)) $tmp=''; //$this->nodes[$thePath]['attributes'][$attribute] = $append ? $tmp . $value : $value; $tmp = $append ? $tmp . $value : $value; } else { </NewCode> Later! dan On 02 Oct 2001 22:16:55 +0000, [EMAIL PROTECTED] wrote: > Suggestion...it is becoming a well know fact that preg is much faster > than the ereg engine, while also being much more powerful. Would it be > possible to rid of ereg functions in this class? > > Dan > > On 02 Oct 2001 21:43:55 +0000, [EMAIL PROTECTED] wrote: > > Overall I am quite impressed. I am running xpath.class.php on a > > hurricane electric dual-PIII server and I have some good results as well > > as some bad. Building up the tree for a 1,000 line (fair complex) xml > > file takes 0.17 seconds and to dump it back out directly to either a > > string or file takes 0.13 seconds, so a total of 0.3 seconds, which is > > pretty darn quick for 1000 lines. Adding children and attributes takes > > no time at all and is neglible in the results. Evaluating can be > > tricky...for 1000 lines it can take up to 0.27 seconds, depending on > > where the node is located for 1000 lines. The extremely variable (and > > slow) feature is the removeChild function, which if removing a child at > > the end of a set of nodes, takes almost no time at all (0.03 seconds) > > but if it is at the beginning, (0.4 seconds) So to process a 1000 line > > XML file with a few modifications here and there, takes about 1 second > > if the modifications are involved with heavy evaluating and removing, > > and as fast as 0.3 seconds if the modifications deal soley with adding > > and modifying. > > > > So, thoughts on the removeChild function, any way to make this faster? > > > > Dan > > > > > > -- > > This message has been sent through the <phpXML/> user discussion list. To >unsubscribe, please visit >https:[EMAIL PROTECTED]/ > > -- > This message has been sent through the <phpXML/> user discussion list. To >unsubscribe, please visit >https:[EMAIL PROTECTED]/ -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https:[EMAIL PROTECTED]/ _______________________________________________ Phpxmldb-phpxml-arc mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/phpxmldb-phpxml-arc