Sign in to follow this  
SteveC

Invalid Xml Format Error

Recommended Posts

Can anyone point out to me what is wrong with the XML listed below for rendering an MSCombi2D chart? When I try to export the chart using the Server-side Image Saver DLL on our server, no chart is rendered but it displays 'Invalid XML format'. I've eyeballed the XML as well as put it into the Visual Studio 2005 XML file format and I haven't been able to see what is wrong with the XML.

 

I'm using the following command where 'theXML' contains the XML listed below.

Dim ssh As ServerSideImageHandler = New ServerSideImageHandler("MSCombi2D.swf, 720, 400, theXML, "", sExportFilename.ToString())

 

ssh.BeginCapture()

 

Thanks again for your help.

Steve

 

Here's the XML being generated:

 

<chart caption='Productivity %' adjustDiv='0' plotGradientColor='' animation='0' canvasBorderThickness='1' showBorder='0' outCnvBaseFont='Arial' outCnvBaseFontSize='12' outCnvbaseFontColor='000000' bgColor='ffffff' bgAlpha='100' YAxisName='% Productivity' yAxisMinValue='0' yAxisMaxValue='2' numDivLines='4' showLegend='1' legendBgColor='ffffff' legendBgAlpha='100' legendIconScale='1' legendInteractive='1' decimals='0' borderSize='0' labelDisplay='Rotate' slantLabels='1' exportEnabled='1' exportAction='save' exportAtClient='0' use3DLighting='0'>

 

<Categories>

 

<Category Label='2010' />

 

<Category Label='YTD-AVG' />

 

<Category Label='Jan-11' />

 

<Category Label='Feb-11' />

 

<Category Label='Mar-11' />

 

<Category Label='Apr-11' />

 

<Category Label='May-11' />

 

<Category Label='Jun-11' />

 

<Category Label='Jul-11' />

 

<Category Label='Aug-11' />

 

<Category Label='Sep-11' />

 

<Category Label='Oct-11' />

 

<Category Label='Nov-11' />

 

<Category Label='Dec-11' />

 

</Categories>

 

<dataset seriesName='Actual' showValues='1' color='0a3c91' includeInLegend='1' renderAs='Column' parentYAxis='P' valuePosition='auto'>

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

</dataset>

 

<dataset seriesName='Plan' showValues='0' color='ff0000' includeInLegend='1' renderAs='Line' parentYAxis='P' valuePosition='auto'>

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

<set value='' />

 

</dataset>

 

<styles>

 

<definition>

 

<style name='MyTitleFont' type='font' font='Arial' size='12' align='center' color='000000' />

 

<style name='MyXAxisFont' type='font' font='Arial' size='12' />

 

<style name='MyYAxisFont' type='font' font='Arial' size='10' color='000000' bold='1' />

 

</definition>

 

<application>

 

<apply toObject='CAPTION' styles='MyTitleFont' />

 

<apply toObject='SUBCAPTION' styles='MyTitleFont' />

 

<apply toObject='XAxisName' styles='MyXAxisFont' />

 

<apply toObject='PAxisName' styles='MyYAxisFont' />

 

</application>

 

</styles>

 

</chart>

 

Share this post


Link to post
Share on other sites

And just in case an image of what I'm seeing helps, I've attached a copy of the problem.

post-19508-0-44530200-1316517903_thumb.png

I forgot to mention that this is running on a Windows Server 2008 R2 server with FlashPlayer 11 Beta 2 for 64-bit.

Share this post


Link to post
Share on other sites

Hi Steve,

 

If you get an "Invalid XML Data" message, it means that the XML data document is malformed.

 

 

Could you please try once using <categories> end with </categories> and not <Categories> or </Categories>

 

Also, category element should be <category Label='2010' />

 

I hope this helps :).

 

 

 

Share this post


Link to post
Share on other sites

Hi Radis,

 

Thanks for the response. I discovered that the problem is the '%' in the chart name. I've escaped that out and that part is working properly, but now I'm encountering what seems to be a similar problem with another 'special char' in the XML below which I haven't been able to locate the offending char. Is there some rule as to when to use the double-quotes around attributes versus single-quotes? Does it matter if one is used over the other as long as they are all consistent?

 

<chart caption="Aged WIP" adjustDiv="0" plotGradientColor="" animation="0" canvasBorderThickness="1" showBorder="0" outCnvBaseFont="Arial" outCnvBaseFontSize="12" outCnvbaseFontColor="000000" bgColor="ffffff" bgAlpha="100" YAxisName="$ in Millions" yAxisMinValue="0" yAxisMaxValue="1" numDivLines="6" showLegend="1" legendBgColor="ffffff" legendBgAlpha="100" legendIconScale="1" legendInteractive="1" decimals="2" borderSize="0" labelDisplay="Rotate" slantLabels="1" exportEnabled="1" exportAction="save" exportAtClient="0" use3DLighting="0"><categories><category label="2010" /><category label="YTD" /><category label="Jan-11" /><category label="Feb-11" /><category label="Mar-11" /><category label="Apr-11" /><category label="May-11" /><category label="Jun-11" /><category label="Jul-11" /><category label="Aug-11" /><category label="Sep-11" /><category label="Oct-11" /><category label="Nov-11" /><category label="Dec-11" /></categories><dataset><dataset seriesName="0-30 Days" showValues="0" color="0a3c91" includeInLegend="1" renderAs="Column" parentYAxis="P" valuePosition="auto"><set value="5.276526" /> <set value="" /> <set value="0.282" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </dataset><dataset seriesName="31-60 Days" showValues="0" color="7f7f7f" includeInLegend="1" renderAs="Column" parentYAxis="P" valuePosition="auto"><set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </dataset><dataset seriesName="61-90 Days" showValues="0" color="ffff00" includeInLegend="1" renderAs="Column" parentYAxis="P" valuePosition="auto"><set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </dataset><dataset seriesName=">90 Days" showValues="0" color="008800" includeInLegend="1" renderAs="Column" parentYAxis="P" valuePosition="auto"><set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </dataset></dataset><lineset seriesName="Plan" showValues="0" color="ff0000" includeInLegend="1" parentYAxis="P" valuePosition="auto"><set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </lineset><styles><definition><style name="MyTitleFont" type="font" font="Arial" size="12" align="center" color="000000" /><style name="MyXAxisFont" type="font" font="Arial" size="12" /><style name="MyYAxisFont" type="font" font="Arial" size="10" color="000000" bold="1" /></definition><application><apply toObject="CAPTION" styles="MyTitleFont" /><apply toObject="SUBCAPTION" styles="MyTitleFont" /><apply toObject="XAxisName" styles="MyXAxisFont" /><apply toObject="PAxisName" styles="MyYAxisFont" /></application></styles></chart>

 

 

 

Hi Steve,

 

If you get an "Invalid XML Data" message, it means that the XML data document is malformed.

 

 

Could you please try once using <categories> end with </categories> and not <Categories> or </Categories>

 

Also, category element should be <category Label='2010' />

 

I hope this helps :).

 

 

 

Share this post


Link to post
Share on other sites

Forgot to mention for the last XML that the chart being used is the StackedColumn2DLine.swf. I realized that the XML below includes the <lineset> tag which isn't part of that chart's XML. So I'm switching that over to the <dataset> tags.

 

Hi Radis,

 

Thanks for the response. I discovered that the problem is the '%' in the chart name. I've escaped that out and that part is working properly, but now I'm encountering what seems to be a similar problem with another 'special char' in the XML below which I haven't been able to locate the offending char. Is there some rule as to when to use the double-quotes around attributes versus single-quotes? Does it matter if one is used over the other as long as they are all consistent?

 

<chart caption="Aged WIP" adjustDiv="0" plotGradientColor="" animation="0" canvasBorderThickness="1" showBorder="0" outCnvBaseFont="Arial" outCnvBaseFontSize="12" outCnvbaseFontColor="000000" bgColor="ffffff" bgAlpha="100" YAxisName="$ in Millions" yAxisMinValue="0" yAxisMaxValue="1" numDivLines="6" showLegend="1" legendBgColor="ffffff" legendBgAlpha="100" legendIconScale="1" legendInteractive="1" decimals="2" borderSize="0" labelDisplay="Rotate" slantLabels="1" exportEnabled="1" exportAction="save" exportAtClient="0" use3DLighting="0"><categories><category label="2010" /><category label="YTD" /><category label="Jan-11" /><category label="Feb-11" /><category label="Mar-11" /><category label="Apr-11" /><category label="May-11" /><category label="Jun-11" /><category label="Jul-11" /><category label="Aug-11" /><category label="Sep-11" /><category label="Oct-11" /><category label="Nov-11" /><category label="Dec-11" /></categories><dataset><dataset seriesName="0-30 Days" showValues="0" color="0a3c91" includeInLegend="1" renderAs="Column" parentYAxis="P" valuePosition="auto"><set value="5.276526" /> <set value="" /> <set value="0.282" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </dataset><dataset seriesName="31-60 Days" showValues="0" color="7f7f7f" includeInLegend="1" renderAs="Column" parentYAxis="P" valuePosition="auto"><set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </dataset><dataset seriesName="61-90 Days" showValues="0" color="ffff00" includeInLegend="1" renderAs="Column" parentYAxis="P" valuePosition="auto"><set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </dataset><dataset seriesName=">90 Days" showValues="0" color="008800" includeInLegend="1" renderAs="Column" parentYAxis="P" valuePosition="auto"><set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </dataset></dataset><lineset seriesName="Plan" showValues="0" color="ff0000" includeInLegend="1" parentYAxis="P" valuePosition="auto"><set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> <set value="" /> </lineset><styles><definition><style name="MyTitleFont" type="font" font="Arial" size="12" align="center" color="000000" /><style name="MyXAxisFont" type="font" font="Arial" size="12" /><style name="MyYAxisFont" type="font" font="Arial" size="10" color="000000" bold="1" /></definition><application><apply toObject="CAPTION" styles="MyTitleFont" /><apply toObject="SUBCAPTION" styles="MyTitleFont" /><apply toObject="XAxisName" styles="MyXAxisFont" /><apply toObject="PAxisName" styles="MyYAxisFont" /></application></styles></chart>

 

 

 

 

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Thanks for your post.

 

Could you please confirm whether you have managed to resolve your problem or not ?

 

Awaiting for your response.

Share this post


Link to post
Share on other sites

I have managed to get the chart to export now whereas before it wasn't. Now the problem I'm working on is to properly encode the special XML characters '<', '>', '%', single-quote, double-quote, and the '&' symbol when they are part of the axis labels or other parts of text attributes. These are resulting in the 'Invalid XML Format' error. I've tried substituting the '%25' for the '%' but it is just treating that as a string literal and not translating it into '%' when rendered. I've also tried the '%' string but that didn't seem to work either.

 

Thanks,

Steve

 

Hi,

 

Thanks for your post.

 

Could you please confirm whether you have managed to resolve your problem or not ?

 

Awaiting for your response.

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Thanks for your response.

Could you please confirm whether you are using DataURL() or DataXML() method?

You can directly embed most of the special characters and punctuation marks in the XML/JSON data source of your chart. However, &, <, >, ' (apostrophe) and "(quote) need to be specially encoded when providing the same as a part of the chart data. Apart from this, there is no need to encode any other special character.

 

More details at:http://www.fusioncha...unctuation.html

Hope this helps.

Share this post


Link to post
Share on other sites

I'm using the .NET server-side save image utility so I'm not sure which approach it is using. I'm guessing is the DataXML(). So I'm constructing the XML as a string into 'theXML' variable and then issuing the following function call:

ServerSideImageHandler(sChart.ToString(), 720, 400, theXML, "", sExportFilename.ToString())

 

I've tried encoding the characters and wrapping the XML values in single-quotes and double-quotes but to no affect.

 

If you could take the attached XML and point out to me what is wrong in this instance, I'd appreciate it. The 4th dataset should have a dataset name of '> 90'.

 

XMLFile1.xml

 

Hi,

 

Thanks for your response.

Could you please confirm whether you are using DataURL() or DataXML() method?

You can directly embed most of the special characters and punctuation marks in the XML/JSON data source of your chart. However, &, <, >, ' (apostrophe) and "(quote) need to be specially encoded when providing the same as a part of the chart data. Apart from this, there is no need to encode any other special character.

 

More details at:http://www.fusioncha...unctuation.html

Hope this helps.

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Could you please confirm the FusionCharts version you are using?

 

Awaiting for your response.

Share this post


Link to post
Share on other sites

We're using v3.2.1 and these files:

 

FusionCharts.js 10/6/2010 11:14am

FusionChartsExportComponent.js 9/15/2010 9:02am

highcharts.js 10/6/2010 8:59am

FCExporter.swf 9/15/2010 2:08am

 

ShockwaveFlashObjects.dll 6/3/2011 12:44pm

AxShockwaveFlashObjects.dll 6/3/2011 12:44pm

FusionChartsImageSaver.dll 6/3/2011 1:15pm

FusionChartsImageSaver.xml 6/3/2011 1:15pm

 

Fusion Charts version:

 

Info: Chart loaded and initialized.

Initial Width: 1162

Initial Height: 741

Scale Mode: noScale

Debug Mode: Yes

Application Message Language: EN

Version: 3.2.1

Chart Type: Stacked 2D Column Line Chart

 

Hi,

 

Could you please confirm the FusionCharts version you are using?

 

Awaiting for your response.

Share this post


Link to post
Share on other sites

Do you have any update on this issue yet? Was the attached XML correct?

 

Thanks,

Steve

 

We're using v3.2.1 and these files:

 

FusionCharts.js 10/6/2010 11:14am

FusionChartsExportComponent.js 9/15/2010 9:02am

highcharts.js 10/6/2010 8:59am

FCExporter.swf 9/15/2010 2:08am

 

ShockwaveFlashObjects.dll 6/3/2011 12:44pm

AxShockwaveFlashObjects.dll 6/3/2011 12:44pm

FusionChartsImageSaver.dll 6/3/2011 1:15pm

FusionChartsImageSaver.xml 6/3/2011 1:15pm

 

Fusion Charts version:

 

Info: Chart loaded and initialized.

Initial Width: 1162

Initial Height: 741

Scale Mode: noScale

Debug Mode: Yes

Application Message Language: EN

Version: 3.2.1

Chart Type: Stacked 2D Column Line Chart

 

 

Share this post


Link to post
Share on other sites

I've tried modifying the XML of the Chart to use the isHTML='1' setting within the Styles for CAPTION and DATALABELS still to no avail. I'm still getting the 'Invalid XML Format'. I compared the resulting XML for the chart against the examples within the documentation and it looks alike to me. I've attached the XML for the Chart for your expert insight :^).

 

Any suggestions would be much appreciated.

 

Thanks,

Steve

 

FusionChartSample.txt

 

Do you have any update on this issue yet? Was the attached XML correct?

 

Thanks,

Steve

 

 

Share this post


Link to post
Share on other sites

Hi Steve,

 

I am afraid, I am unable to replicate the issue. :(

 

The chart is displayed perfectly with the Styles applied as you have specified with the XML from your previous post.

 

Please check with the attached screenshot for your reference.

 

post-8144-0-40502900-1318408291_thumb.jpg

 

Hope this helps. :)

Share this post


Link to post
Share on other sites

Hi Sanjukta,

 

Just a quick question. When you ran the XML from my previous post, did you use the FusionChartsImageSaver .NET wrapper or did you use the usual FusionCharts DLLs? The reason I ask is because I am getting the chart to display correctly as well when I go through the FusionCharts DLL. It's only when I try to create the chart via the FusionChartsImageSaver .NET wrapper that it comes back with the 'Invalid xml format' error.

 

Thanks for the clarification.

Steve

 

Hi Steve,

 

I am afraid, I am unable to replicate the issue. :(

 

The chart is displayed perfectly with the Styles applied as you have specified with the XML from your previous post.

 

Please check with the attached screenshot for your reference.

 

post-8144-0-40502900-1318408291_thumb.jpg

 

Hope this helps. :)

Share this post


Link to post
Share on other sites

Hi,

 

Could you please URL encode the "&" sign to "%26" and see if this helps?

 

 

However, to let you know that the updated Image Saver Assembly has the encoding issue fixed. Please mail us at FusionCharts Support quoting this forum thread to receive the same.

 

Hope this helps. :)

Share this post


Link to post
Share on other sites

Hi Sanjukta,

 

I have tried the encoding of "%26" but no translation occurs. It just prints out the literal text '%26' and not the '&' character.

 

Thanks, I'll try sending email to support requesting the updated Saver Assembly.

 

Regards,

Steve

 

Hi,

 

Could you please URL encode the "&" sign to "%26" and see if this helps?

 

 

However, to let you know that the updated Image Saver Assembly has the encoding issue fixed. Please mail us at FusionCharts Support quoting this forum thread to receive the same.

 

Hope this helps. :)

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Thanks for your response.

 

Looking forward to your mail.

 

Happy FusionCharting!!!

Share this post


Link to post
Share on other sites

Thank you everyone for your help. The updated FusionChartsImageSaver did indeed include the fix for the encoding problem. I am now exporting the 700+ charts with the proper encoding and getting the correct '>', '<', '%' characters as expected.

 

Happy charting everyone!

Steve

 

Hi,

 

Thanks for your response.

 

Looking forward to your mail.

 

Happy FusionCharting!!!

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Glad to know that you have managed to resolve your problem.

 

Keep smiling and keep FusionCharting! biggrin.gif

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