ERROR: Invalid XML encountered.
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        


12»»

ERROR: Invalid XML encountered. Expand / Collapse
Author
Message
Posted 1/1/2008 6:18:28 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/10/2008 4:51:36 PM
Posts: 9, Visits: 13
I'm pulling db generated xml and using xslt to transform it to FC readable XML.  The output xml is written to a webpage by document.write(fc_xml).  This page is then used as the URL for dataURL.

The content is not visible if fc_xml is loaded, but the source listing is correct.

<?xml version="1.0" encoding="UTF-8"?>
<chart caption="test" decimals="0" enableSmartLabels="1">
<set label="Alchemy" value="4" />
<set label="Orion/Pegasus" value="38" />
<set label="Other" value="56" />
<set label="SandCraft" value="34" />
<set label="Scalable Processor Solutions" value="57" />
</chart>

I always get this error: "ERROR: Invalid XML encountered. A start-tag is not matched with an end-tag. Click the above "dataURL Invoked" link to see the XML in browser Or check the XML data provided."

Post #3569
Posted 1/2/2008 11:36:37 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/10/2008 4:51:36 PM
Posts: 9, Visits: 13
Alright, now I know the problem with document.write(), it's doesn't work for XML.

Now, I'm using the DOM to parse the string returned by an XSL transform.  I then use the xml of the returned DOM object as the setDataXML.  Now I get a different error message:

ERROR: Invalid XML encountered. The XML declaration is not properly terminated.

How can that be, the xml was created by DOM?

Post #3585
Posted 1/3/2008 12:04:22 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 10/5/2008 9:41:33 AM
Posts: 809, Visits: 1,285
Hi,

Can you try passing the XML as String using toString().

Regards,

Sudipto Choudhury
FusionCharts Team

Post #3586
Posted 1/3/2008 12:32:13 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/10/2008 4:51:36 PM
Posts: 9, Visits: 13
I tried passing doc.xml.toString().  did not work.

I tried removing the xml declaration, the example for setDataXML did not have it.  did not work.

I tried passing the string from xsl transform without the declaration.  still did not work.

The error says malformed XML.  This is the string I'm setting.  I pasted this string in, and still did not work.

'<chart caption="test" decimals="0" enableSmartLabels="1"><set label="Alchemy" value="4" /><set label="Orion/Pegasus" value="38" /><set label="Other" value="56" /><set label="SandCraft" value="34" /><set label="Scalable Processor Solutions" value="57" /></chart>'

Post #3588
Posted 1/3/2008 12:49:42 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/10/2008 4:51:36 PM
Posts: 9, Visits: 13
The setDataXML expects the string to have single quotes for the attributes.  This is Version 3.  I dropping back down to the Version2 or Free and see what happens.

This works.

myChart.setDataXML("<chart caption='test' decimals='0' enableSmartLabels='1'><set label='Alchemy' value='4' /><set label='Orion/Pegasus' value='38' /><set label='Other' value='56' /><set label='SandCraft' value='34' /><set label='Scalable Processor Solutions' value='57' /></chart>");

This does not work.

myChart.setDataXML('<chart caption="test" decimals="0" enableSmartLabels="1"><set label="Alchemy" value="4" /><set label="Orion/Pegasus" value="38" /><set label="Other" value="56" /><set label="SandCraft" value="34" /><set label="Scalable Processor Solutions" value="57" /></chart>');

Post #3589
Posted 1/3/2008 1:13:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/10/2008 4:51:36 PM
Posts: 9, Visits: 13
Just confirmed.  FCFree has the same bug on setDataXML method.

<set label='name' value='1' />, works

<set label="name" value="1" />, does not work

Post #3591
Posted 1/3/2008 1:15:19 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/10/2008 4:51:36 PM
Posts: 9, Visits: 13
One more idea, do a replace " with ' on my string using regular expression.
Post #3592
Posted 1/3/2008 7:07:12 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/10/2008 4:51:36 PM
Posts: 9, Visits: 13
Finally!!!.  Thanks for sugessting the string.  It got me thru debug faster and with shorter script.  I don't have to parse XML anymore, just send the XSL transformed string and replace the double quotes.
Post #3599
Posted 1/7/2008 5:10:43 AM