Guest Madhumita

Single and double quotes in an XML value

Recommended Posts

Sorry if this is answered elsewhere but I've been searching here and Google and can't find anything.

 

 

 

Is there a way to have single and double quotes in a label when using the dataXML method of embedding XML right in your HTML?

 

 

 

Here's the first attempt I had with the HTML, the important part anyway:

 

 

 

4034250969_11ea7a93aa_o.png

 

 

 

Obviously the double quotes in the XML closed the HTML parameter, so the Fusion Chart gives an XML error and everything after the first quote shows up as text on the page. So I replaced those quotes with either %22 or &quot, obviously with the ; on the end, just can't do it here because the forums turn it into quotes:

 

 

 

4035005314_098d104148_o.png

 

 

 

And that works fine. The .swf loads and reads the XML correctly. But I need to prepare for single and double quotes in the XML itself. Using " or &quot or %22, any of it would break the page.

 

 

 

Anyone got a solution for me? I appreciate any help.

post-6691-128441576516_thumb.png

post-6691-128441576519_thumb.png

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

Welcome to FusionCharts Forum.

When using dataXML method, you need to be very careful about conflict of quotation marks. For example, if you're using single quotation marks in your XML document for attributes, make sure to use double quotation marks to encapsulate the entire XML string in your HTML page as attribute of OBJECT/EMBED element. Conflicts in quotes often do not raise errors, but you keep wondering why the chart is not getting rendered (and you get a white blank space instead of chart).

 

 

Using dataXML method in direct HTML embedding:-

 

Create a copy of Chart.html and save it as ChartDataXML.html. Also, modify the code as under:

<html>

<body bgcolor="#ffffff">

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="300" id="Column3D" >

<param name="movie" value="../FusionCharts/Column3D.swf" />

<param name="FlashVars" value="&dataXML=<chart caption='Monthly Sales Summary' subcaption='For the year 2006' xAxisName='Month' yAxisName='Sales' numberPrefix='$'><set label='January' value='17400' /><set label='February' value='19800' /><set label='March' value='21800' /><set label='April' value='23800' /><set label='May' value='29600' /><set label='June' value='27600' /><set label='July' value='31800' /><set label='August' value='39700' /><set label='September' value='37800' /><set label='October' value='21900' /><set label='November' value='32900' /><set label='December' value='39800' /></chart>">

<param name="quality" value="high" />

<embed src="../FusionCharts/Column3D.swf" flashVars="&dataXML=<chart caption='Monthly Sales Summary' subcaption='For the year 2006' xAxisName='Month' yAxisName='Sales' numberPrefix='$'><set label='January' value='17400' /><set label='February' value='19800' /><set label='March' value='21800' /><set label='April' value='23800' /><set label='May' value='29600' /><set label='June' value='27600' /><set label='July' value='31800' /><set label='August' value='39700' /><set label='September' value='37800' /><set label='October' value='21900' /><set label='November' value='32900' /><set label='December' value='39800' /></chart>" quality="high" width="900" height="300" name="Column3D" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

</object>

</body>

</html>

As you can see above, we have provided the complete data by appending it as a FlashVars attribute in the following format:

<PARAM NAME="FlashVars" Value="&dataXML=completeXMLData">

and in the EMBED tag, you'll have to add the following:

<EMBED ... FlashVars="&dataXML=completeXMLData">

 

Ref:-http://www.fusioncharts.com/docs/Contents/DataXML.html

Hope this helps. ;)

 

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