Can anyone point me to a simple php script to write to XML?

Discussion in 'Programming' started by minus19, Dec 21, 2007.

  1. #1
    Yep, if you could it would be much appreciated. Basically, I just need a front end and some simple php to allow someone to have a very simple gui to write a file in xml with pre-defined tags. Then I can add some AJAX validation and dress it up a bit.

    I had a look in google but I didn't get the right type of script, I don't have time to research it as it's part of a christmas present to a in law :/ so if anyone knows off hand that would be great and i'd possibly love you for ever...

    cheers
     
    minus19, Dec 21, 2007 IP
  2. pratham

    pratham Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use the SimpleXML library to ease your XML handling.

    
    $xml = new SimpleXMLElement($xmlstr);
    
    $character = $xml->movie[0]->characters->addChild('character');
    $character->addChild('name', 'Mr. Parser');
    $character->addChild('actor', 'John Doe');
    
    PHP:
     
    pratham, Dec 22, 2007 IP