Sign in to follow this  
Arindam

Character problems in creating dynamic XML in Java

Recommended Posts

Hello everyone,

 

 

 

I'm using Java to create the XML data required for the Fusion Charts. I create a string containing the xml code and then pass it to the Chart with setDataXML. The chart will load with data obtained from a DB and that data may change if a new timeline is selected. I'm trying to create a pie chart with a link to a javascript function. Here is where things get tricky.

 

 

 

If I do:

 

 xmlStr += " link="JavaScript:jsMethod('" + parameter + "')"" ; 

 

the chart loads correctly at first, but if I try to get a different set of data it will return 'Invalid XML data'

 

 

 

If I try:

 

 xmlStr += " link="JavaScript:jsMethod('" + parameter + "')"" ; 

 

the page loads with 'Invalid XML data' but it works fine when selecting a different set of data.

 

The same happens if I try:

 

 xmlStr += " link='JavaScript:jsMethod(& apos;" + parameter + "& apos; )'" ; 

 

(In my code the & apos; is together)

 

 

 

Any idea of what is wrong? Does the setDataXML method do something different the first time it is called from following calls?

 

 

 

Thanks in advance :)

Share this post


Link to post
Share on other sites

Hi,

Could you please use this?

If you are using DataXML method please use this

 xmlStr += " link='JavaScript:jsMethod(%26apos;" + parameter + "%26apos; )'" ;

If you are using DataURL method please use this

 xmlStr += " link='JavaScript:jsMethod('" + parameter + "' )'" ;

Edited by Guest

Share this post


Link to post
Share on other sites

 

 

 

xmlStr += " link='JavaScript:jsMethod(%26apos;" + parameter + "%26apos; )'" ;

 

 

 

 

 

 

It worked :) Thank you very much. But any idea on the reason of the problem?

Share this post


Link to post
Share on other sites

Hi

 

 

 

First of all a correction. In my first post where it says

 

 

If I do:

 

xmlStr += " link="JavaScript:jsMethod('" + parameter + "')"" ;

 

 

 

 

should be: xmlStr += " link=& quot;JavaScript:jsMethod('" + parameter + "')& quot;" ;

 

 

 

I can see now why it would return 'Invalid XML data'. But I still can't understand why it wouldn't return that error on all ocasions.

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