SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old February 8th, 2004, 08:15 PM
newhouse newhouse is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 newhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Problem: Adding a child in a XML file with PHP & DOM

I have this xml file:
Code:
<?xml version='1.0' encoding='ISO-8859-1'?> 
<news>         
  <new type="Trips">                 
    <title>I'm going to Amsterdam</title>                 
    <date>07/02/04</date>                 
    <content>Yesterday, I decide to go to Amsterdam with my friend of NEWI, we decide to go 7 days and now we are nervous</content>         
  </new>         

  <new type="Me">                 
    <title>I'm very happy</title>                 
    <date>05/02/04</date>                 
    <content>Today I've spoken with my best friend and now i'm very happy</content>         
  </new> 
</news> 


Now, I want to add a new new child of news with the sames childs but with different information.
The information is not a problem but I don't know why but I can't find a good solution for my problem.

I've start to do some like that but this simple code doesn't work:
Some ideas??

PHP Code:
<html
<
head>     
<
title>Sugerencias</title> </head
<?
php 
$ttl 
$_POST["title"]; 
$cnt $_POST["content"]; 
$Sub $_POST["subject"];   

$dom domxml_open_file("news.xml") OR die ("Couldn't load news.xml");  $elements $dom->get_elements_by_tagname("new"); 
$element $elements[0];  
$newnode $element->insert_before($element$element); 

  
echo 
"<PRE>"$xmlfile $dom->dump_mem();
echo 
htmlentities($xmlfile); 
echo 
"</PRE>";   
</
body
</
html


Thanks a lot!!!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Problem: Adding a child in a XML file with PHP & DOM


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway