<?xml version="1.0" encoding="utf-8"?>
<activities>
<activity category="Team">
<date><h4>Date: January 15, 2017</h4></date>
<work>
<li><b>MR X</b> working on X</li>
<li><b>MR Y</b> working on Y</li>
<li><b>MR Z</b> working on <a href="#">Z</a></li>
</work>
</activity>
</activities>
The above one is the XML file. Suppose the file name is activities.xml.
Now I want to parse the data in php. But I want to get the <b>
and <a>
tag intact. Means I want to get the line <b>MR Z</b> working on <a href="#">Z</a>
directly when I parse using li tag. Is that possible? How to get the text with the links and show it?
My php code is something like below:
<?php
$xmls=simplexml_load_file("activities.xml") or die("Error: Cannot create object");
foreach ($xmls as $xml) {
echo $xml->date;
echo $xml->work;
}
?>