Hi David,
I need your help!
I don't know how to do this?
I need to parse a xml file and display a result like this following exemple but my result is wrong!!:
the result I need :
------------------
blabla.......................(myProductRecordHandler Long descrption)
MEMORY:(Title1 of my FeatureGroup list result)
Ram(myFeature name value) : 1024 MB (myFeature value)
PROCESSOR FAMILY:(Title2 of my FeatureGroup list result)
Processor(myFeature name value) : Intel celeron (myFeature value)
the actual Result is:
-------------
Long description: blabla.......................
Title1(FeatureGroup list result)
Title2 (FeatureGroup list result)
Ram(myFeature name value) : 1024 MB (myFeature value)
Processor(myFeature name value) : Intel celeron (myFeature value)
Here is my code:
----------------
<?php
require("MagicParser.php");
// first parse to extract the top level product information
function myProductRecordHandler($record)
{
$record["PRODUCT/PRODUCTDESCRIPTION-LONGDESC"];
print '<link href="css/ice.css" rel="stylesheet" type="text/css">';
print "<table cellspacing='1px' width='100%' >";
print "<tr>";
print "<td class='desc'>";
print "<p>".$record["PRODUCT/PRODUCTDESCRIPTION-LONGDESC"]."</p>";
print "</td>";
print "</tr>";
print "</table>"; }
$url="http://localhost/data/".$_GET['doc'];
MagicParser_parse($url,"myProductRecordHandler","xml|XML-INTERFACE/");
// second parse to extract the FeatureGroup list
print "<table cellspacing='1px' class='border1'>";
function myFeatureGroupRecordHandler($record1)
{
$record1["FEATUREGROUP/NAME-VALUE"];
print "<tr>";
print $record1["FEATUREGROUP/NAME-VALUE"]."";
print "</tr>";
}
MagicParser_parse($url,"myFeatureGroupRecordHandler","xml|XML-INTERFACE/PRODUCT/CATEGORYFEATUREGROUP/");
// third parse to extract the feature list
function myFeatureRecordHandler($record)
{
$record["PRODUCTFEATURE-VALUE"];
print "<tr>";
print "<td class='label'>";
print $record["FEATURE/NAME-VALUE"].": ";
print "</td>";
print "<td class='data'>";
print $record["PRODUCTFEATURE-VALUE"]." ";
print $record["FEATURE/MEASURE-SIGN"];
print "</td>";
print "</tr>";
}
MagicParser_parse($url,"myFeatureRecordHandler","xml|XML-INTERFACE/PRODUCT/PRODUCTFEATURE/");
print "</table>";
?>
So, can you show me the right way to do this ;-)
Thanks a lot..
Cheers, Umbro909
Hi Dear David,
I've just one word to say...............
PERFECT!!!!!!!
You are Formidable.
Thanks again :-)
Cheers.
Umbro909
Hiya,
Without your XML file it's a bit difficult to work it out for you. Do you think you could email me a copy of a sample XML file and I will try your code out? Reply to your registration code or forum registration email is the easiest way to get me!
Cheers,
David.