Sign in to follow this  
Powderworks

Invalid XML data

Recommended Posts

I am getting a invalid XML data error message

Is there any way I can generate the XML data so that I can see the problem

I am using this Code

xmlData.Append(

"<chart caption='' subCaption='OUTSTANDING RECOMMENDATIONS ' pieSliceDepth='30' showBorder='' showYAxisValues='0' formatNumberScale='0' numberSuffix=''>");

//Create recordset to get details for the factories

//string factoryQuery = " SELECT Count(Recommendations) as TotNo FROM recommendations WHERE Complete = "No" , Count(Recommendation) as TotYes FROM recommendations WHERE Complete = "Yes"" ;

string factoryQuery3 = "SELECT location.LocationName, recommendations.Complete, Count(*) as TotQ FROM recommendations INNER JOIN inspection ON recommendations.InspectionID = inspection.InspectionID INNER JOIN location ON inspection.LocationID = location.LocationID WHERE Complete ='Outstanding' GROUP BY recommendations.Complete,location.LocationName";

Share this post


Link to post
Share on other sites

Hi,

 
Could you please send us the complete code along with the generated XML, also please let us know the chart SWF name that you are using?
Edited by Guest

Share this post


Link to post
Share on other sites

Thanks for coming back to me

This chart was working fine for three weeks as 154 records were added to the database

The error occurred after the last 3 records were added

Here is the complete Code for the chart

public string GetFactorySummaryChartHtml()

{

//In this example, we show how to connect FusionCharts to a database.

//For the sake of ease, we've used an Access database which is present in

//../App_Data/FactoryDB.mdb. It just contains two tables, which are linked to each

//other.

//xmlData will be used to store the entire XML document generated

StringBuilder xmlData = new StringBuilder();

//Generate the chart element

xmlData.Append(

"<chart caption='' subCaption='OUTSTANDING RECOMMENDATIONS ' pieSliceDepth='30' showBorder='' showYAxisValues='0' formatNumberScale='0' numberSuffix=''>");

//Create recordset to get details for the factories

//string factoryQuery = " SELECT Count(Recommendations) as TotNo FROM recommendations WHERE Complete = "No" , Count(Recommendation) as TotYes FROM recommendations WHERE Complete = "Yes"" ;

string factoryQuery3 = "SELECT location.LocationName, recommendations.Complete, Count(*) as TotQ FROM recommendations INNER JOIN inspection ON recommendations.InspectionID = inspection.InspectionID INNER JOIN location ON inspection.LocationID = location.LocationID WHERE Complete ='Outstanding' GROUP BY recommendations.Complete,location.LocationName";

DbConn oRs = new DbConn(factoryQuery3);

//Iterate through each record

while (oRs.ReadData.Read())

{

xmlData.AppendFormat(

"<set label='{0}' value='{1}' />", (oRs.ReadData["LocationName"].ToString()), oRs.ReadData["TotQ"].ToString());

//xmlData.AppendFormat("<set label='{0}' value='{1}' />", oRs.ReadData["Complete"].ToString(), oRs.ReadData["TotQ"].ToString());

}

oRs.ReadData.Close();

//Close chart element

xmlData.Append(

"</chart>");

//Create the chart - Pie 3D Chart with data from xmlData

return FusionCharts.RenderChart("FusionCharts/Bar2D.swf?noCache=5", "", xmlData.ToString(), "FactorySum3", "400", "150", false, false);

}

Share this post


Link to post
Share on other sites

Hi,

 
Please use this code: 

public string GetFactorySummaryChartHtml()

{

//In this example, we show how to connect FusionCharts to a database.

//For the sake of ease, we've used an Access database which is present in

//../App_Data/FactoryDB.mdb. It just contains two tables, which are linked to each

//other.

//xmlData will be used to store the entire XML document generated

StringBuilder xmlData = new StringBuilder();

//Generate the chart element

xmlData.Append(

"<chart caption='' subCaption='OUTSTANDING RECOMMENDATIONS ' pieSliceDepth='30' showBorder='' showYAxisValues='0' formatNumberScale='0' numberSuffix=''>");

//Create recordset to get details for the factories

//string factoryQuery = " SELECT Count(Recommendations) as TotNo FROM recommendations WHERE Complete = "No" , Count(Recommendation) as TotYes FROM recommendations WHERE Complete = "Yes"" ;

string factoryQuery3 = "SELECT location.LocationName, recommendations.Complete, Count(*) as TotQ FROM recommendations INNER JOIN inspection ON recommendations.InspectionID = inspection.InspectionID INNER JOIN location ON inspection.LocationID = location.LocationID WHERE Complete ='Outstanding' GROUP BY recommendations.Complete,location.LocationName";

DbConn oRs = new DbConn(factoryQuery3);

//Iterate through each record

while (oRs.ReadData.Read())

{

xmlData.AppendFormat(

"<set label='{0}' value='{1}' />", (oRs.ReadData["LocationName"].ToString()), oRs.ReadData["TotQ"].ToString());

//xmlData.AppendFormat("<set label='{0}' value='{1}' />", oRs.ReadData["Complete"].ToString(), oRs.ReadData["TotQ"].ToString());

}

oRs.ReadData.Close();

//Close chart element

xmlData.Append(

"</chart>");

//Create the chart - Pie 3D Chart with data from xmlData

//return FusionCharts.RenderChart("FusionCharts/Bar2D.swf?noCache=5", "", xmlData.ToString(), "FactorySum3", "400", "150", false, false);

return Server.HtmlEncode(xmlData.ToString());

}

The above code will display the XML data.
 
 

Share this post


Link to post
Share on other sites

thanks I got the XML data as below but can't see what is causing Invalid XML is it the dash sign "-"

I put the XX in

<chart caption='' subCaption='OUTSTANDING RECOMMENDATIONS ' pieSliceDepth='30' showBorder='' showYAxisValues='0' formatNumberScale='0' numberSuffix=''>

<set label='XX Food and Beverage' value='10' />

<set label='XX Garlic Bread' value='1' />

<set label='XX Stuff Bakery' value='4' />

<set label='XXJasol Australia - O'Connor' value='10' />

<set label=',XXasol Australia - Stapylton' value='10' />

<set label='XX Bakery' value='13' />

<set label='XX Castlemaine - Castlemaine' value='18' />

<set label='XXMauri Yeast - Camellia' value='12' />

<set label='XXMauri Yeast- Toowoomba' value='8' />

<set label='XX Top - Christchurch' value='13' />

<set label='XX Top Bakeries - Canning Vale' value='3' />

<set label='XX Bakeries - Chullora' value='12' />

<set label='XX Bakeries - Dry Creek' value='4' />

<set label='XX Taste' value='15' />

<set label=XX Milling - Enfield' value='5' />

<set label='XX Milling - North Melbourne' value='3' />

<set label='XX Milling - Northam' value='1' />

<set label=XX Milling - Wellington' value='7' /></chart> 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this