473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

how to remove an xml node using php?

this is my php code:

$dir=getcwd();
$xmlDoc=$dir."/xml1.xml";

$xdoc = new DOMDocument;
$xdoc->validateOnParse = true;
$xdoc->Load($xmlDoc);

$book = $xdoc->documentElement;

$xp = new DomXPath($xdoc);

$res = $xp->query("//*[@id = '".$id."']");
//$chapter = $xp->getElementsByTagName('club')->item(0);
$oldchapter = $book->removeChild($res->item(0));
echo $test = $xdoc->save($xmlDoc);

i want to use query function also...

plz help me...
Oct 4 '07 #1
1 2972
jkmyoung
2,057 Expert 2GB
What node are you trying to remove? What does your source xml look like? Why isn't it working as it is?
Oct 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Girish | last post by:
I have this XML FILE where I am reading data from and it has this node doctype "< ! D O C T Y P E a d f S Y S T E M " h t t p : / / w h o s c a l l i n g . c o m / d t d / a d f d t d . d t d...
2
by: Claudio Jolowicz | last post by:
How can XSLT stylesheets be used to edit, remove and add nodes specified by their position in the document tree? The XML document stores development tasks in a hierarchical way, i.e. tasks can...
1
by: Steve S | last post by:
I need some help modifying this code. The code was orginally setup to add/remove a single table row. I modified it to add 2 (two) rows with one column that spans both rows. That part works. I...
6
by: Boobie | last post by:
Is there any other way to remove a node/element other than going into the Parent and do "removeChild" ? thanks (need to remove a div of id "foobar")
6
by: Nikhil Patel | last post by:
Hi all, Following is a portion of an XML document. I need to remove all nodes that belong to ns0 without deleting their child nodes. So in the following example , I want to delete "ns0:Proposal"...
2
by: Sam | last post by:
I am attempting to remove a full node. XML Example: <Videos> <Video> <Name>Crocodile Dundee 2</Name> <Media>DVD</Media> </Video> <Video> <Name>Terminator 6</Name> <Media>DVD</Media>
2
by: William | last post by:
Have somebody a brilliant idea how to remove a nodelist in a XML document? (With C#) I have this xml file,I want delete the stock nodelist when an user don't have permissions to see stocklist of...
2
by: fizzy | last post by:
i am fetching an xml document with the following structure: <?xml version="1.0" encoding="UTF-8"?> <DTCResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
6
by: pavel.repkin | last post by:
Hey! How would you do the following task? Let you have an XML tree on input. Suppose, there is a special kind of node you want to remove. Let it have "bad" name. Each "bad" node has a parent...
11
by: David | last post by:
Hi All, I am working on a script that is theoreticaly simple but I can not get it to work completely. I am dealing with a page spit out by .NET that leaves empty tags in the markup. I need a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.