On Fri, 21 Jan 2005 12:02:51 +0100, Mike Blank
<[EMAIL PROTECTED]> wrote:
> Hi Guys!
> 
> I've got a problem with Dom and php 5.0.2. I'm trying to access an xml
> node with $item = $objDom->documentElement->childNodes->item(0);. That
> seems to work, because on the next line I can output the node Value with
> echo $item->nodeValue. But when I use the command
> $objDom->removeChild($item); on the next line, dom throws a
> DOMException:

$objDom has to to be the parent node of $item., not the document itself.

$objDom->documentElement->removeChild($item);
should work in your case. or more general

$item->parentNode->removeChild($item);

chregu

> 
> Fatal error: Uncaught exception 'DOMException' with message 'Not Found
> Error' in
> /opt/lampp/htdocs/www/snap_chubb/extensions/features/mitarbeiter/main.fe
> a.php:13 Stack trace: #0
> /opt/lampp/htdocs/www/snap_chubb/admin/admin.class.php(179): require()
> #1 /opt/lampp/htdocs/www/snap_chubb/admin/admin.class.php(154) :
> eval()'d code(1): Admin->editFeature(Object(DOMElement)) #2
> /opt/lampp/htdocs/www/snap_chubb/admin/admin.class.php(154): eval() #3
> /opt/lampp/htdocs/www/snap_chubb/admin/index.php(142):
> Admin->drawContent() #4 {main} thrown in
> /opt/lampp/htdocs/www/snap_chubb/extensions/features/mitarbeiter/main.fe
> a.php on line 13
> 
> Below you can see my code:
> 
> Index.php
> -----------------------------------------------------------------------
> 
> $objDom = new DomDocument(); // neues dom objekt
> $strXML = $this->loadXMLTree($objDATA->fields['pfe_con_id']); //
> funktion, die eine xml datei als string aus der db ausliest if ($strXML
> != false) {
>         $objDom->loadXML($strXML); // string wird in das dom objekt
> geladen } $item = $objDom->documentElement->childNodes->item(0); //
> adressierung eines knoten echo $item->nodeValue; // ausgabe funktioniert
> ohne probleme
> $objDom->removeChild($item); // diese zeile spuckt den oben genannten
> Error aus!
> 
> Geladener XML string
> -----------------------------------------------------------------------
> 
> <?xml version="1.0"?>
> <root>
>         <mitarbeiter>
>                 <image>/images/43/team_fabian-bischof_kl.jpg</image>
>                 <name>Fabian Bischof</name>
>                 <detailpage>45</detailpage>
>         </mitarbeiter>
>         <mitarbeiter>
>                 <image>/images/43/team_sandra-varela_kl.jpg</image>
>                 <name>Sandra Varela</name>
>                 <detailpage>0</detailpage>
>         </mitarbeiter>
>         <mitarbeiter>
>                 <image>/images/43/team_sandra-varela_kl.jpg</image>
>                 <name>Sandra Varela</name>
>                 <detailpage>0</detailpage>
>         </mitarbeiter>
> </root>
> -----------------------------------------------------------------------
> 
> I hope somebody can help me somehow! I'm really desperate!
> 
> Cheers
> 
> mike
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
http://www.bitflux.ch  |  [EMAIL PROTECTED]  |  gnupg-keyid 0x5CE1DECB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to