Sign in to follow this  
MartinS

Invalid XML Data When Using & in Axis Name

Recommended Posts

Hi

I have a series of charts that are generated from individual links on a page, and two of these links contain an ampersand in the text.  This definitely worked without any problems in the version of Fusion prior to 3, but since we have upgraded out application to use v3, I get an 'Invalid XML Data' message for the two charts that contain the ampersand.

I have tried changing it to %26, also & but both cause the same effect.  I have supplied my XML below so you can maybe point me at what is wrong with the Xml being used to create my chart.

<chart animation="1" bgAlpha="0,0" showBorder="0" useRoundEdges="1" setAdaptiveYMin="1" numberScaleValue="1000000,1000" numberScaleUnit="M,B" caption="" xAxisName="D&B score of guarantor" yAxisName="" xAxisMinValue="1" xAxisMaxValue="100" yAxisMinValue="0" yAxisMaxValue="1000000" showDivLineValues="1" adjustDiv="0" numDivLines="4" decimals="2" showValues="1" showLegend="1" legendBorderAlpha="0" legendBgAlpha="0" legendPosition="Bottom" legendShadow="0" labelDisplay="Wrap" exportEnabled="1" exportHandler="" exportAtClient="1" exportShowMenuItem="0" exportAction="download">
 <categories>
 <category label="1" x="1"/>
 <category label="11" x="11"/>
 <category label="21" x="21"/>
 <category label="31" x="31"/>
 <category label="41" x="41"/>
 <category label="51" x="51"/>
 <category label="61" x="61"/>
 <category label="71" x="71"/>
 <category label="81" x="81"/>
 <category label="91" x="91"/>
 </categories>
 <dataset seriesName="Scheme based levy" anchorSides="3" color="5074D1" alpha="100" includeInLegend="1" showValues="0" drawLine="1">
 <set y="232000" x="1"/>
 <set y="232000" x="3"/>
 <set y="232000" x="5"/>
 <set y="232000" x="7"/>
 <set y="232000" x="9"/>
 <set y="232000" x="11"/>
 <set y="232000" x="13"/>
 <set y="232000" x="15"/>
 <set y="232000" x="17"/>
 <set y="232000" x="19"/>
 <set y="232000" x="21"/>
 <set y="232000" x="23"/>
 <set y="232000" x="25"/>
 <set y="232000" x="27"/>
 <set y="232000" x="29"/>
 <set y="232000" x="31"/>
 <set y="232000" x="33"/>
 <set y="232000" x="35"/>
 <set y="232000" x="37"/>
 <set y="232000" x="39"/>
 <set y="232000" x="41"/>
 <set y="232000" x="43"/>
 <set y="232000" x="45"/>
 <set y="232000" x="47"/>
 <set y="232000" x="49"/>
 <set y="232000" x="50"/>
 <set y="232000" x="52"/>
 <set y="232000" x="54"/>
 <set y="232000" x="56"/>
 <set y="232000" x="58"/>
 <set y="232000" x="60"/>
 <set y="232000" x="62"/>
 <set y="232000" x="64"/>
 <set y="232000" x="66"/>
 <set y="232000" x="68"/>
 <set y="232000" x="70"/>
 <set y="232000" x="72"/>
 <set y="232000" x="74"/>
 <set y="232000" x="76"/>
 <set y="232000" x="78"/>
 <set y="232000" x="80"/>
 <set y="232000" x="82"/>
 <set y="232000" x="84"/>
 <set y="232000" x="86"/>
 <set y="232000" x="88"/>
 <set y="232000" x="90"/>
 <set y="232000" x="92"/>
 <set y="232000" x="94"/>
 <set y="232000" x="96"/>
 <set y="232000" x="98"/>
 <set y="232000" x="100"/>
 </dataset>
 <dataset seriesName="Total levy" anchorSides="3" color="840006" alpha="100" includeInLegend="1" showValues="0" drawLine="1">
 <set y="998027" x="1"/>
 <set y="998027" x="3"/>
 <set y="998027" x="5"/>
 <set y="998027" x="7"/>
 <set y="998027" x="9"/>
 <set y="998027" x="11"/>
 <set y="998027" x="13"/>
 <set y="998027" x="15"/>
 <set y="998027" x="17"/>
 <set y="998027" x="19"/>
 <set y="998027" x="21"/>
 <set y="998027" x="23"/>
 <set y="998027" x="25"/>
 <set y="998027" x="27"/>
 <set y="998027" x="29"/>
 <set y="998027" x="31"/>
 <set y="998027" x="33"/>
 <set y="998027" x="35"/>
 <set y="998027" x="37"/>
 <set y="998027" x="39"/>
 <set y="998027" x="41"/>
 <set y="998027" x="43"/>
 <set y="998027" x="45"/>
 <set y="998027" x="47"/>
 <set y="998027" x="49"/>
 <set y="998027" x="50"/>
 <set y="998027" x="52"/>
 <set y="998027" x="54"/>
 <set y="998027" x="56"/>
 <set y="998027" x="58"/>
 <set y="998027" x="60"/>
 <set y="998027" x="62"/>
 <set y="998027" x="64"/>
 <set y="998027" x="66"/>
 <set y="998027" x="68"/>
 <set y="998027" x="70"/>
 <set y="998027" x="72"/>
 <set y="998027" x="74"/>
 <set y="998027" x="76"/>
 <set y="998027" x="78"/>
 <set y="998027" x="80"/>
 <set y="998027" x="82"/>
 <set y="998027" x="84"/>
 <set y="998027" x="86"/>
 <set y="998027" x="88"/>
 <set y="974639" x="90"/>
 <set y="945119" x="92"/>
 <set y="925439" x="94"/>
 <set y="905759" x="96"/>
 <set y="876239" x="98"/>
 <set y="836879" x="100"/>
 </dataset>
 <dataset seriesName="Current position" anchorSides="3" color="BE9400" alpha="100" includeInLegend="1" showValues="0" drawLine="1">
 <set y="0" x="95"/>
 <set y="915599" x="95"/>
 </dataset>
 <styles>
 <definition>
  <style name="myCaptionFont" type="font" font="Verdana" size="16" color="000000"/>
  <style name="myXAxisTitlesFont" type="font" font="Verdana" size="13" color="000000" bold="0"/>
  <style name="myYAxisTitlesFont" type="font" font="Verdana" size="13" color="000000" bold="0"/>
  <style name="myYAxisValues" type="font" font="Verdana" color="000000" bold="0"/>
  <style name="myDataLabels" type="font" font="Verdana" color="000000" bold="0"/>
  <style name="myDataValues" type="font" font="Verdana" color="000000" bold="0"/>
 </definition>
 <application>
  <apply toObject="Caption" styles="myCaptionFont"/>
  <apply toObject="XAxisName" styles="myXAxisTitlesFont"/>
  <apply toObject="YAxisName" styles="myYAxisTitlesFont"/>
  <apply toObject="YAXISVALUES" styles="myYAxisValues"/>
  <apply toObject="DATALABELS" styles="myDataLabels"/>
  <apply toObject="DATAVALUES" styles="myDataValues"/>
 </application>
 </styles>
</chart>

I'd appreciate any help with understanding why this chart does not render as I'd expect - it's being used with the scatter.swf.

Thanks

Martin

Share this post


Link to post
Share on other sites

Hi Martin,

Thanks for the XML, could you please also let us know whether you are using dataXML or dataURL method to provide data to the chart?

Also please note that if you are using dataXML method then you would need to use ' (single quote) instead of double quote (") everywhere in your XML (to attribute & value pair), so your modified XML would be like:

<chart animation='1' bgAlpha='0,0' showBorder='0' useRoundEdges='1' setAdaptiveYMin='1' numberScaleValue='1000000,1000' numberScaleUnit='M,B' caption='' xAxisName='D%26B score of guarantor' yAxisName='' xAxisMinValue='1' xAxisMaxValue='100' yAxisMinValue='0' yAxisMaxValue='1000000' showDivLineValues='1' adjustDiv='0' numDivLines='4' decimals='2' showValues='1' showLegend='1' legendBorderAlpha='0' legendBgAlpha='0' legendPosition='Bottom' legendShadow='0' labelDisplay='Wrap' exportEnabled='1' exportHandler='' exportAtClient='1' exportShowMenuItem='0' exportAction='download'> <categories>  <category label='1' x='1'/>  <category label='11' x='11'/>  <category label='21' x='21'/>  <category label='31' x='31'/>  <category label='41' x='41'/>  <category label='51' x='51'/>  <category label='61' x='61'/>  <category label='71' x='71'/>  <category label='81' x='81'/>  <category label='91' x='91'/> </categories> <dataset seriesName='Scheme based levy' anchorSides='3' color='5074D1' alpha='100' includeInLegend='1' showValues='0' drawLine='1'>  <set y='232000' x='1'/>  <set y='232000' x='3'/>  <set y='232000' x='5'/>  <set y='232000' x='7'/>  <set y='232000' x='9'/>  <set y='232000' x='11'/>  <set y='232000' x='13'/>  <set y='232000' x='15'/>  <set y='232000' x='17'/>  <set y='232000' x='19'/>  <set y='232000' x='21'/>  <set y='232000' x='23'/>  <set y='232000' x='25'/>  <set y='232000' x='27'/>  <set y='232000' x='29'/>  <set y='232000' x='31'/>  <set y='232000' x='33'/>  <set y='232000' x='35'/>  <set y='232000' x='37'/>  <set y='232000' x='39'/>  <set y='232000' x='41'/>  <set y='232000' x='43'/>  <set y='232000' x='45'/>  <set y='232000' x='47'/>  <set y='232000' x='49'/>  <set y='232000' x='50'/>  <set y='232000' x='52'/>  <set y='232000' x='54'/>  <set y='232000' x='56'/>  <set y='232000' x='58'/>  <set y='232000' x='60'/>  <set y='232000' x='62'/>  <set y='232000' x='64'/>  <set y='232000' x='66'/>  <set y='232000' x='68'/>  <set y='232000' x='70'/>  <set y='232000' x='72'/>  <set y='232000' x='74'/>  <set y='232000' x='76'/>  <set y='232000' x='78'/>  <set y='232000' x='80'/>  <set y='232000' x='82'/>  <set y='232000' x='84'/>  <set y='232000' x='86'/>  <set y='232000' x='88'/>  <set y='232000' x='90'/>  <set y='232000' x='92'/>  <set y='232000' x='94'/>  <set y='232000' x='96'/>  <set y='232000' x='98'/>  <set y='232000' x='100'/> </dataset> <dataset seriesName='Total levy' anchorSides='3' color='840006' alpha='100' includeInLegend='1' showValues='0' drawLine='1'>  <set y='998027' x='1'/>  <set y='998027' x='3'/>  <set y='998027' x='5'/>  <set y='998027' x='7'/>  <set y='998027' x='9'/>  <set y='998027' x='11'/>  <set y='998027' x='13'/>  <set y='998027' x='15'/>  <set y='998027' x='17'/>  <set y='998027' x='19'/>  <set y='998027' x='21'/>  <set y='998027' x='23'/>  <set y='998027' x='25'/>  <set y='998027' x='27'/>  <set y='998027' x='29'/>  <set y='998027' x='31'/>  <set y='998027' x='33'/>  <set y='998027' x='35'/>  <set y='998027' x='37'/>  <set y='998027' x='39'/>  <set y='998027' x='41'/>  <set y='998027' x='43'/>  <set y='998027' x='45'/>  <set y='998027' x='47'/>  <set y='998027' x='49'/>  <set y='998027' x='50'/>  <set y='998027' x='52'/>  <set y='998027' x='54'/>  <set y='998027' x='56'/>  <set y='998027' x='58'/>  <set y='998027' x='60'/>  <set y='998027' x='62'/>  <set y='998027' x='64'/>  <set y='998027' x='66'/>  <set y='998027' x='68'/>  <set y='998027' x='70'/>  <set y='998027' x='72'/>  <set y='998027' x='74'/>  <set y='998027' x='76'/>  <set y='998027' x='78'/>  <set y='998027' x='80'/>  <set y='998027' x='82'/>  <set y='998027' x='84'/>  <set y='998027' x='86'/>  <set y='998027' x='88'/>  <set y='974639' x='90'/>  <set y='945119' x='92'/>  <set y='925439' x='94'/>  <set y='905759' x='96'/>  <set y='876239' x='98'/>  <set y='836879' x='100'/> </dataset> <dataset seriesName='Current position' anchorSides='3' color='BE9400' alpha='100' includeInLegend='1' showValues='0' drawLine='1'>  <set y='0' x='95'/>  <set y='915599' x='95'/> </dataset> <styles>  <definition> <style name='myCaptionFont' type='font' font='Verdana' size='16' color='000000'/> <style name='myXAxisTitlesFont' type='font' font='Verdana' size='13' color='000000' bold='0'/> <style name='myYAxisTitlesFont' type='font' font='Verdana' size='13' color='000000' bold='0'/> <style name='myYAxisValues' type='font' font='Verdana' color='000000' bold='0'/> <style name='myDataLabels' type='font' font='Verdana' color='000000' bold='0'/> <style name='myDataValues' type='font' font='Verdana' color='000000' bold='0'/>  </definition>  <application> <apply toObject='Caption' styles='myCaptionFont'/> <apply toObject='XAxisName' styles='myXAxisTitlesFont'/> <apply toObject='YAxisName' styles='myYAxisTitlesFont'/> <apply toObject='YAXISVALUES' styles='myYAxisValues'/> <apply toObject='DATALABELS' styles='myDataLabels'/> <apply toObject='DATAVALUES' styles='myDataValues'/>  </application> </styles></chart>

And in the above XML we also changed & to %26 which is now working fine with dataXML method.

Hope this helps.

Share this post


Link to post
Share on other sites

Thank Rahul

I just needed to replace the % with %26 at a different point in the code, and it now works as expected.  Thansk for your help.

Martin

Share this post


Link to post
Share on other sites

Actually, maybe it's not quite resolved...

The chart now renders, which is an improvement but by setting the xaxisname to equal 'D%26B Score', it renders that in the chart as exactly that, not changing the '%26' to '&' as I'd expect.

I loaded the XML into another XML program to find if there were any errors, which is why they are all shown encased in " not ', and in answer to your question I am using the dataXML approach.

Any suggestions how to display '&' within the axis title text and still have fully formed XML?

Thanks

Martin

Share this post


Link to post
Share on other sites

Hi,

Could you please send us a working sample so that we can run it in our labs and check for the issue, also it is working fine is our labs please see the attached image.

44eaf464-f980-4c71-9d79-9781.png

Share this post


Link to post
Share on other sites

Hi

Do you just want the entire XML that is generated?  I can't send you a working application, the Xml is the best I can do.

If I load the chart Xml into, say, XmlSpy, it tells me the label tag is invalid as it contains an ampersand, which was what I assumed was the problem.  This has worked before, and has only shown up since we have upgraded to the latest version of fusion so wondered if something had changed - it would appear that is not the case, so am a bit confused as to why it has stopped working.  And it does only not work for the two charts with & in the axis text - the other five charts are fine.

Let me know if the XML is sufficient.

Thanks

Martin

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

Please send us the generated XML that you get from the debug window and also specify the dimensions of the chart with which you are rendering.

Share this post


Link to post
Share on other sites

Many apologies - I reviewed the xml, and found some code which replaced % with %25, so %26 became %2526, which was why it did not work. I have fixed this code and am now getting the ampersand as expected and it's all working as i'd expect.  Sorry to waste your time, and thanks for your help. :blush:

Martin

Share this post


Link to post
Share on other sites
Guest Madhumita

Hey,

 

 

 

It was no trouble at all. Glad that you have solved the issue.

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