Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7617439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:09:02+00:00 2026-05-31T03:09:02+00:00

well guys this code trow this exception and I dont know why… exception: Fatal

  • 0

well guys this code trow this exception and I dont know why…

exception: Fatal error: Uncaught exception ‘DOMException’ with message
‘Not Found Error’ in
C:\AppServ\www\CpVela\publicidades\delete_pub.php:14 Stack trace: #0
C:\AppServ\www\CpVela\publicidades\delete_pub.php(14):
DOMNode->removeChild(Object(DOMElement)) #1 {main} thrown in
C:\AppServ\www\CpVela\publicidades\delete_pub.php on line 14

    <?php
   include "../src/defines.php";
if(!empty($_GET['CDG'])){
    $doc = new DOMDocument; 
    $doc->load(DIR_PUBLICIDADES);
    $thedocument = $doc->documentElement;
    $list = $thedocument->getElementsByTagName('item');
    echo $list->length;
    $nodeToRemove = NULL;
    foreach ($list as $domElement){
      $attrValue = $domElement->getAttribute('numero');
      if ($attrValue == $_GET['CDG']) {
        $nodeToRemove = $domElement; 
        $thedocument->removeChild($nodeToRemove); // <<< line 14
        $f = fopen(DIR_PUBLICIDADES,'w+'); 
        fwrite($f,$doc->saveXML()); 
        fclose($f); 
      }
    }
    if ($nodeToRemove != null){

        $thedocument->removeChild($nodeToRemove);
        $f = fopen(DIR_PUBLICIDADES,'w+'); 
        fwrite($f,$doc->saveXML()); 
        fclose($f); 
    }
}
    header("location:publicidades.php"); 


    ?>

my code XML is

<?xml version="1.0" encoding="utf-8"?>
<publicidades>
    <internas>
        <item nombre="Tony Roma's" numero="SOL_17"   posX="266" posY="229" telefono="" web="" correo="" encargado="" descripcion=""  promocion="" ></item>
    </internas>
    <externas>

    </externas>
</publicidades>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:09:03+00:00Added an answer on May 31, 2026 at 3:09 am

    The problem is with your removeChild method.
    This error is a result of:

    Raised if oldnode is not a child of this node.

    $nodeToRemove reffers to <item,
    while $thedocument reffers to the root element node which is <publicidades>.

    <item> is a child of <internas> not of <public...>.

    EDIT:
    Try adding:

    $internas = $doc->documentElement->getElementsByTagName('internas');
    

    right after:

    $thedocument = $doc->documentElement;
    

    and then:(EDIT2)

    foreach ($internas as $node) {
        $node->parentNode->removeChild($node);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, I know this is another newbie question but I'm very frustrated and I'm
Well I have this code - function breadcrumbs($separator = ' &raquo; ', $home =
Alright guys, well, here is the thing. I used this wonderful website and found
Rather basic question here guys. Basically I have code like this: public SuperPanel() {
Well guys, this problem just baffles me. I hope someone can explain to me
Well guys, here i am. In three days i couldn't resolve this problem. (I'm
This code is not valid: private void Foo(string optionalString = string.Empty) { // do
Hey guys, I'm using Twitter's PHP API, called twitterlibphp , and it works well,
Well, this is my first post here and really enjoying the site. I have
Well this is incredibly frustrating. After being nagged by Rails that I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.