Fw: xpath getNode problem
Brought to you by:
bs_php,
nigelswinson
|
From: Nigel S. <nig...@us...> - 2005-08-29 20:24:45
|
=20
----- Original Message -----=20
From: Suzanne Slatcher=20
To: nig...@us...=20
Sent: Tuesday, August 23, 2005 7:47 PM
Subject: xpath getNode problem
Hi Nigel
Firstly I should thank you for php.xpath. Without it I don't think I =
could have done what I was trying to do.
But there's one thing I can't quite work out -=20
I have a structure like this to store notes hierarchically:
<NOTES>
<NOTE id=3D"1"><HEAD>heading 1</HEAD><KIDS></KIDS></NOTE>
<NOTE id=3D"2"><HEAD>heading 2</HEAD><KIDS>
<NOTE id=3D"3"><HEAD>heading 3</HEAD><KIDS></KIDS></NOTE>
</KIDS></NOTE>
<NOTE id=3D"4"><HEAD>heading 4</HEAD><KIDS></KIDS></NOTE>
</NOTES>
and what I'd like to do is move 'NOTE 2', along with the contents of =
it's KIDS (ie 'NOTE 3') to the KIDS scope of 'NOTE 1'=20
I'm assuming I'd have to store 'NOTE 2' as a variable, then delete it =
from the document, then re-insert it in the new place, but I'm having =
problems storing it in a variable.
I've tried various combinations of getNode, eg:
$note[] =3D $x->getNode('/NOTES[1]/NOTE[2]');
but I must be missing something as print_r($note); is always empty
how would you suggest I go about this?
thankyou very much for your time
Suzanne
--=20
s p a r k h i v e
hold that thought
www.sparkhive.com
|