For example, you have an xml document:
<?php
$xml = '<?xml version="1.0"?>';
$xml .= '<data>';
$xml .= '<name>Luna Maya</name>';
$xml .= '<city>Denpasar</city>';
$xml .= '<age>27</age>';
$xml .= '</data>';
$xmlDoc = new DOMDocument();
// if the xml document lies on the file, use $xmlDoc->load('your_file.xml');
$xmlDoc->loadXML($xml);
$name = $xmlDoc->getElementsByTagName('name');
echo $name->item(0)->nodeValue;
No comments:
Post a Comment