Friday, November 4, 2011

How to create xml file with php code

how to create xml file with php code

Here you learn create xml file with the help of php
<?php

$xml = new SimpleXMLElement("<?xml version='1.0' encoding='iso-8859-1'?><content/>");

$track = $xml->addChild('section');
$track->addAttribute('name','settings');

$item=$xml->addChild('item', 'true');
$item->addAttribute('name','textSelectable');

$item=$xml->addChild('item', 'gold');
$item->addAttribute('name','copyright');

$item=$xml->addChild('item', 'Silver');
$item->addAttribute('name','companyName');
$track = $xml->addChild('section');

?>

No comments:

Post a Comment