AW: RemoveChild Problem
Brought to you by:
bs_php,
nigelswinson
From: J. C. <jan...@im...> - 2001-12-18 08:33:38
|
Hi, Thanks for the answer - the explanation was exactly as I already thought, but even when I tried to re-run evaluate() after each removeChild() or even with using reset() it did not help - maybe I did it wrong, but shouldn't that be the correct solution??? Any advice for a nice working script to solve this? Finally I decided to export the file after each removeChild() and read it in again - that is quite slow of cause but works at least. Don't worry about the other errors (side effects of the same problem I think - MON11 is quite similar to MON10). Cheers Jan > -----Ursprüngliche Nachricht----- > Von: php...@li... > [mailto:php...@li...]Im Auftrag von Nigel > Swinson > Gesendet: Dienstag, 11. Dezember 2001 23:48 > An: php...@li... > Betreff: Re: RemoveChild Problem > > > If you have: > > <DATA> > <MON10> > <geburtstag> > <datum>1007124443</datum> > <name>hgvghv</name> > <tag>9</tag> > </geburtstag> > <geburtstag> > <datum>1007124467</datum> > <name>adsd</name> > <tag>9</tag> > </geburtstag> > </MON10> > </DATA> > > And you search for: > > $path = $xpath_del->evaluate("/*/*/geburtstag"); > > Then you get: > > /DATA[1]/MON10[1]/geburtstag[1] > /DATA[1]/MON10[1]/geburtstag[2] > > Now if you delete /DATA[1]/MON10[1]/geburtstag[1], then your XML becomes: > > <DATA> > <MON10> > <geburtstag> > <datum>1007124467</datum> > <name>adsd</name> > <tag>9</tag> > </geburtstag> > </MON10> > </DATA> > > So when you now try to delete /DATA[1]/MON10[1]/geburtstag[2] it doesn't > exist does it? As there is only one geburtstag[] child node of MON10. > Which is why you get: > > > Warning: Undefined index: geburtstag[2] in > > E:\imeso\web\portal\data\xpath.class.php on line 1098 > > There are other errors in your sample output, but as your sample > output does > not completely match the XML that you have mailed, (ie what is MON11??) I > can't really help you with the others. > > Nigel > > =========================== > For the most recent version of Php.XPath, and an archive of this > list visit: > http://www.sourceforge.net/projects/phpxpath > > > _______________________________________________ > Phpxpath-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpxpath-users |