wizkid Report post Posted March 30, 2008 hye, im trying to load graph dynamiclly with javascript xmldocument object this is my code : <head> <xml id="xmlPie" src="XML/DataPie.xml"></xml> </head> <script> var myChart = new FusionCharts("../../Assets/GuiObjectsV2/FusionCharts/Charts/Pie3D.swf", "myChartId", "205", "150", "1", "0"); var a = xmlPie.xml; myChart.setDataXML(a); </script> inisde xmlPie.xml there is this xml: <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> and i get the error (from the debugger): INFO: XML Data provided using dataXML method. ERROR: Invalid XML encountered. An XML element is malformed. Click the above "dataURL Invoked" link to see the XML in browser Or check the XML data provided. hope you can help me, im stuck. erez. Share this post Link to post Share on other sites
Pallav Report post Posted March 30, 2008 Your XML seems to be invalid. Please check that. Share this post Link to post Share on other sites
FusionCharts Support Report post Posted March 31, 2008 Hi, Could you try using single Quotes in the attributes of your XML file? You can also try using myChart.setDataURL("XMLPath/DataPie.xml"); which might reduce the number of code lines used. Share this post Link to post Share on other sites
wizkid Report post Posted March 31, 2008 how can the xml be invalid. this is the javascript xmldocument object. im loading it in the head - and then im pushing it to the fusion chart object - no human touch at all. how can that be? by the way : this is just an example - the real issue is to change the xml before loading it into the chart so it willl be dynamic ajax like. thats why i cant use setdaraurl method. 10x ! erez/ Share this post Link to post Share on other sites
Pallav Report post Posted March 31, 2008 You're doing it the wrong way too. The setDataXML method expects a string value for XML. Share this post Link to post Share on other sites
wizkid Report post Posted April 2, 2008 ok, maby i didnt get it right - i have an html page im loading xml in the head tag <head> <xml id="xmlPie" src="XML/DataPie.xml"></xml> </head> now in the script i want to see it inside of a chart so im doing : var myChart = new FusionCharts("Pie3D.swf", "myChartId", "205", "150", "1", "0"); myChart.setDataXML(xmlPie.xml); and i still get the error. it cannot be that the xml is invalid because in javascript the object xmlPie contains xml value and is perfectly valid - this is an output from c# xmldocument the xml example is : <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> he is valid - i also checked it in xml spy and in visual studio 2005 xml tool. must be a logical explanation for this. 10x!! erez. Share this post Link to post Share on other sites
Pallav Report post Posted April 8, 2008 Pass the string representation of XML to setDataXML() method - not reference. Share this post Link to post Share on other sites