views:

16

answers:

1

I'm getting an 'Invalid XML Data' error for any Fusion Chart which contains a ' (ie. single quote) in the label name for data.

This happens even when I encode/escape the single quote.

Try the following Chart Data:

Obviously when unescaped (as such) we should see an error

<chart shownames='1' caption='Registrant Types'>
    <set value='2' color='AFD8F8' label='Justin's Test'/>
    <set value='3' color='F6BD0F' label='No quote'/>
</chart>

However I would expect that if I encode the quote as follows it should work

<chart shownames='1' caption='Registrant Types'>
    <set value='2' color='AFD8F8' label='Justin%27s Test'/>
    <set value='3' color='F6BD0F' label='No quote'/>
</chart>

The only way I can get it to work is by removing the ' altogether.

+1  A: 

Try:

<set value='2' color='AFD8F8' label='Justin&quot;s Test'/>
Darin Dimitrov
Justin
I would recommend you using XmlWriter or XDocument or XmlDocument to generate XML in .NET. It will take care of encoding.
Darin Dimitrov