Sign in to follow this  
nickpdx

setDataXML says "Invalid XML data" for valid XML that works with setDataURL

Recommended Posts

I have been using the setDataURL method to load charts, but I wanted to switch because I want to further process the chart's XML using JavaScript; I want to get the returned XML, hand it to my chart using setDataXML(), then hand it to further processes.

 

 

 

But setDataXML() complains for every one of my charts, "Invalid XML data." I am attaching the captured XML exactly as it is returned from an ajaxy-type server call. I'm handing it to setDataXML() as a string, so the contents of that string should be exactly equal to what's in the attachment. That said, I fail to see how it's invalid XML.

 

 

 

I have tried removing all newline characters; and removing the link attribute which contains the only characters that are even slightly different (encoded entities) - but those entity encodings still make valid XML. Like I said, this exact same XML when returned via setDataURL() is accepted by the chart just fine.

example xml.txt

Share this post


Link to post
Share on other sites

I found the cause of this issue thru trial and error...

 

 

 

As it turns out, if you call setDataXML() _before_ calling render(), you must escape the XML string using javascript's escape() function. If you later call setDataXML() on the resulting embedded flash object, you don't have to escape the XML.

 

 

 

I don't think this is covered in the documentation, I know that no discussion of escape() exists in the v3 docs section Web Developers > FusionCharts and Javascript.

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