hi i am new in xml and data retrieve and i have problem with this code i just need to display the content of content node but the output is empty please help me
xml code:
<?xml version="1.0" encoding="UTF-8"?>
<site>
<page>
<content><P><FONT size="2" face="Tahoma"><STRONG>text...</STRONG></FONT></P>
<P><FONT size="2" face="Tahoma">text....</FONT></P>
<P align="center"><IMG style="WIDTH: 530px" border="1" alt="" src="http://ift.tt/1ptSSIB"></P>
<P><STRONG><FONT size="2" face="Tahoma">text3</FONT></STRONG></P>
<P><STRONG><FONT size="2" face="Tahoma">text1</FONT></STRONG></P></content>
</page>
</site>
php code:
<!DOCTYPE html>
<html>
<head>
<style>
p{
background-color:red;
}
</style>
</head>
<body>
<?php
$html = "";
$url = "Data.xml";
$xml = simplexml_load_file($url);
for($i = 0; $i<10;$i++){
$title=$xml->page[$i]->content->P->FONT;
$html .="<p>$title</p>";
}
echo $html;
?>
</body>
<html>
i just need to display the content of content node but the output is empty please help me
No comments:
Post a Comment