XML Parsing Error: no element found
Hi,
I'm new to xml.I have got a problem i.e. XML Parsing Error: no element found.
I'm generating xml form php file and write to another file called test.xml.the file is running successfully but with an error.I'm getting the records in test.xml file.
below is the code pls help to come out of ths bug.
parse.php
<?php
header('Content-Type: text/xml');
header("Cache-Control: no-cache, must-revalidate");
$connect=mysql_connect('localhost','root','') or die ("cannot connect");
$db_select = mysql_select_db('qproi_foodreporting',$connect);
//echo $audit;
$AuditDate=$yy."-".$mm."-".$dd;
//$AuditDate='2007-05-12';
$sql="select * from au_audit where AuditDate='$AuditDate'";
//echo $sql;
$res=mysql_query($sql);
$file = fopen("test.xml","w");
fwrite($file,'<?xml version="1.0"?>'."\n");
fwrite($file, "<root>"."\n");
while($row=mysql_fetch_array($res))
{
$auditid=$row[AuditID];
$clientunitid=$row[ClientUnitID];
$overallscore=$row[OverallScore];
$foodscore=$row[FoodScore];
$microscore=$row[MicroScore];
$nonconscore=$row[NonConScore];
$client="select * from cu_client_unit where ClientUnitID='$clientunitid'";
$clientt=mysql_query($client);
while($roww=mysql_fetch_array($clientt))
{
$clientid=$roww[clientid];
$name=$roww[Name];
$regionaldirector=$roww[sortkey1];
}
$mncdeduct="select * from cl_client where Cl_ClientID='$clientid'";
$res1=mysql_query($mncdeduct);
while($r=mysql_fetch_array($res1))
{
$mncd=$r[mncdeduction];
}
if($mnc == 'N/A' || $mnc=='0'){
$mncnum = 'N/A';
}else{
$mncnum = ($nonconscore / $mncd);
}
$url="http://localhost/qpro/report_cover_COM.php?sel=$clientid";
$url.="&au=$auditid&cu=$clientunitid";
fwrite($file,"<row>"."\n");
fwrite($file,"<FacilityName>".$name."</FacilityName>"."\n");
fwrite($file,"<RegionalDirector>".$regionaldirector."</RegionalDirector>"."\n");
fwrite($file,"<QPROGeneralScore>".$overallscore."</QPROGeneralScore>"."\n");
fwrite($file,"<MicroScore>".$microscore."</MicroScore>"."\n");
fwrite($file,"<NumberofMNCS>".$mncnum."</NumberofMNCS>"."\n");
fwrite($file,"<URL>".$url."</URL>"."\n");
fwrite($file,"<row>"."\n");
}
fwrite($file, "<root>");
fclose($file);
mysql_close($connect);
?>
test.xml
<?xml version="1.0"?>
<root>
<row>
<FacilityName>Caltex Bach Street</FacilityName>
<RegionalDirector>Vacant</RegionalDirector>
<QPROGeneralScore>73</QPROGeneralScore>
<MicroScore>65</MicroScore>
<NumberofMNCS>1</NumberofMNCS>
<URL>http://localhost/qpro/report_cover_COM.php?sel=9&au=2&cu=2432</URL>
<row>
<row>
<FacilityName>Caltex Bach Street</FacilityName>
<RegionalDirector>Vacant</RegionalDirector>
<QPROGeneralScore>31</QPROGeneralScore>
<MicroScore>65</MicroScore>
<NumberofMNCS>3</NumberofMNCS>
<URL>http://localhost/qpro/report_cover_COM.php?sel=9&au=3&cu=2432</URL>
<row>
<root>
This is the file from which i'm taking the input
<?php
if(isset($sub)){
header("Location arse.php?dd=$dd&mm=$mm&yy=$yy");
}
?>
<html>
<head>
</head>
<body>
<form name="frm" method="get">
<input type =text name = 'dd' value='<?=$dd?>' size=2 maxlength=2>
<input type="text" name='mm' value="<?=$mm?>" size=2 maxlength=2>
<input type="text" name='yy' value="<?=$yy?>" size=2 maxlength=4>[dd-mm-yy]
<input name="sub" type="submit" value="submit">
</body>
</html>
I'm in need Its very urgent.......
thanx in advance
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks