Top Menu

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’);

?>

About The Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Close