NoBullMan Report post Posted December 15, 2010 (edited) Hi, I am getting Invalid XML Data error and not sure how to resolve it. Some charts display OK and some don't. When I compare the content of XML Data between the ones that work and the ones that don't, the only difference between them is the existence of special characters, like &. Before appending Label/Value pair, I replace all occurences of special characters with their html equivalant ('&' with '&', single quote with '''. etc.) but still get the error. Not sure what else to do or waht else could be wrong. (I am doing this in ASP.Net, C#): foreach (DataRow dr in table.Rows) { string sLabel = dr["Name"].ToString().Replace("'", "'").Replace("&", "&").Replace("\"", ""e;").Replace("\\", "\\\\"); xmlData.AppendFormat("<set label='{0}' value='{1}' /> ", sLabel, Convert.ToInt16(dr["Count"])); } xmlData.Append("</chart>"); return FusionCharts.RenderChartHTML("Charts/FusionCharts/Pie3D.swf", "", xmlData.ToString(), "Dist", "500", "250", true); ] I traced the code and turned on debugging for chart and this is the final XML data (it is 3-D Pie Chart): <chart caption='Machine Distribution' subcaption='(12/14/2010)' lineThickness='1' showValues='1' labelDisplay='Stagger' formatNumberScale='0' anchorRadius='2' divLineAlpha='20' divLineColor='CC3300' divLineIsDashed='1' showAlternateHGridColor='1' alternateHGridColor='000099' shadowAlpha='40' labelStep='1' numvdivlines='5' chartRightMargin='35' bgColor='FFFFFF,000099' bgAngle='270' bgAlpha='10,10' alternateHGridAlpha='5' yAxisName='Rate' yAxisMaxValue='50' lineColor='FF5904'> <set label='ANCHORAGE AMF ' value='11' /> <set label='CEDAR RAPIDS (IA) PDF' value='11' /> <set label='DENVER (CO) PDC ' value='89' /> <set label='DES MOINES (IA) PDC' value='30' /> <set label='EVERETT PDF' value='24' /> <set label='KANSAS CITY (MO) PDC' value='60' /> <set label='MINNEAPOLIS (MN) P&DC' value='61' /> <set label='OMAHA (NE) PDC' value='24' /> <set label='PHOENIX (AZ) PDC' value='7' /> <set label='PORTLAND (OR) PDC' value='33' /> <set label='QUAD CITIES (IL) PDF' value='12' /> <set label='SAINT PAUL (MN) PDC' value='46' /> <set label='SALT LAKE CITY (UT) PDC' value='39' /> <set label='SEATTLE (WA) PDC' value='39' /> </chart> This is the error I see in debug window: ERROR: Invalid XML encountered. An attribute value is not properly terminated. Click the above "dataURL Invoked" link to see the XML in browser Or check the XML data provided. Also, it says 'click the above dataURL Invooked link', but I don;t see any such link to click. Thanks. Edited December 15, 2010 by NoBullMan Share this post Link to post Share on other sites
NoBullMan Report post Posted December 15, 2010 Found my answer here: http://forum.fusioncharts.com/topic/7805-pie-chart-not-work-if-is-present-in-label-or-value/page__p__31239__hl__%2Binvalid+%2Bxml+%2Bdata__fromsearch__1#entry31239 I needed to replace '&' with '%26' (URLEncode instead of HTMLEncode) Share this post Link to post Share on other sites
Guest Angie Report post Posted December 15, 2010 (edited) Hi, Welcome to FusionCharts Forum! When you are using the HTML embedding method with data provided as embedded string, it is essential to encode & character to %26. I'm glad to know your issue has been resolved. Happy FusionCharting! Edited December 15, 2010 by Angie Share this post Link to post Share on other sites
Guest Angie Report post Posted December 15, 2010 Hi, Welcome to FusionCharts Forum! When you are using the HTML embedding method with data provided as embedded string, it is essential to encode & character to %26. I'm glad to know your issue has been resolved. Happy FusionCharting! Share this post Link to post Share on other sites