Re: appendChild help?
Brought to you by:
bs_php,
nigelswinson
From: Dan A. <big...@us...> - 2001-11-06 17:35:49
|
Remember, appendChild returns the absolute path (aka /root[1]/newchild[1]) so that you don't have to figure it out manually after adding the new child. so you can do $newnode = $xml->appendChild("/root[1]","newchild"); $xml->appendData($newnode,"data); Dan On Tue, 06 Nov 2001 14:26:49 GMT Paul / USH <pa...@tr...> wrote: > On 06 Nov 2001 11:41 GMT you wrote: > > > Hi > > > > I've been trying to figure this out too. The only way can do it is to > > appendChild() then appendData() into that child. > > > > $xml->appendChild("/root[1]", "newchild"); > > $xml->appendData("/root[1]/newchild[1]", "some new data here"); > > Thankyou, you've just solved my initial problem > I was using appendData - when I should have been using appendChild first. > > Paul > www.nostalgiagoggles.com > > > > > > It would be nice to be able to to this in one step. > > > > Any help appreciated. > > > > > > Girish > > > > ----- Original Message ----- > > From: "Paul / USH" <pa...@tr...> > > To: <php...@li...> > > Sent: Tuesday, November 06, 2001 11:19 AM > > Subject: appendChild help? > > > > > > > I'm using Php.XPath Version 2.1 and I'm having some trouble understanding > > what to pass into appendChild as the node. > > > > > > Could someone give me a simple example of appending a child to a node. > > > > > > e.g. > > > > > > file contents are <root></root> > > > $xml = new XPath("$filename"); > > > $xml->appendData("/root[1]", "blah" ); > > > > > > What do I put in instead of "blah" to add a node called blah? > > > > > > Paul > > > www.nostalgiagoggles.com > > > _______________________________________________ > Phpxpath-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpxpath-users |