Re: [Q] Domxml: unlink() method?

From: Date: Fri, 02 Feb 2001 11:01:24 +0000
Subject: Re: [Q] Domxml: unlink() method?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-37810@lists.php.net to get a copy of this message
On Thu, Feb 01, 2001 at 09:13:34PM +0200, Teodor Cimpoesu wrote: > > > Peter Sabaini wrote: > > > > hello, > > > > i am rather desperately trying to figure out how to delete a node > > object from the DOM. > > > > say i have a node $node by manually traversing the DOM tree or by an > > xpath_eval() function call. i can access the children > > ($node->children()) or the parent ($node->parent()) or add a sub-node > > ($node->new_child()) but there seems to be no $node->unlink() or > > something like that to remove $node from my DOM tree. > > > > in libxml which the php domxml extension is built upon there's a > > function xmlUnlinkNode() which seems to do just that, but there is no > > binding for this function in php (or i didn't find it. i looked in > > ext/domxml/php_domxml.c). > > > > any solutions / workarounds / patches anyone? or am i being plain > > dumb -- i am pretty a php novice so chances are i overlooked the very > > very obvious. > > > I've been playing w/ DOM XML extension for my documentation catalog > (docs.digiro.net still work in progress ;), and my first shot would be > to unset the node from the children list of its parent. I also dig for > what > methods a DomNode, DomAttribute etc. have and figured out some. I would > like > to see them documented somewhere ... > > -- teodor hi teodor && all, thanks but i am not sure how to accomplish this. eg. if i do: $kids = $parent->children(); $node_to_delete = $kids[0]; unset($node_to_delete); -- this won't cut it because i would just unset $node_to_delete, right? i am not entirely sure what the children() method returns but i guess it is a reference into the tree and unset()ting the reference wont buy me anything. as far as i understand php and references, that is. this would only work if children() would return a true pointer, i think. any further suggestions? i really need this; if i wasnt such a poor c programmer i'd implement it myself... tia, peter. -- Peter Sabaini p.sabaini@netconomy.net NETCONOMY Onlineberatungs- und -management Gmbh & Co KG www.netconomy.net - Schoenaugasse 64, 8010 Graz Tel. +43-(0)316 875-3081.

« previous php.general (#37810) next »