Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Marja on Nov 22, 2007 02:59
open dhtmlx forum
Dynamic loading from XML

Hi,

When I use a server-side ASP script to generate a XML file and use that file to populate the dhtmlCombo, using eg. z.loadXML('mylist.xml'), it works just fine.

But when I try to feed that exact same XML string directly to the dhtmlCombo without first saving it as a XML file, as in z.enableFilteringMode(true,'myscript.asp',true,true), I get a message saying "Incorrect XML".

Can you help? Thanks in advance.

Regards,

Marja de Vroed
Club Webware
The Netherlands
Answer posted on Nov 23, 2007 05:45
Reasons why XML not loaded correctly

a) Simplest but most common - please be sure that path which you used inside loadXMl command valid and produce correct XML response.
b) Please check that XML response generated by script are correct XML
    - synax correct ( some special chars can corrupt output, also if you are uses encoding different from UTF-8, please be sure that  it correctly specified in XML header )
    - correct content type assigned - text/xml
    - in case of FF, there must not be any whitespaces before start  of output and <?xml declaration
to check all those requirements , just point your browser to XML generation script - if all correct browser will render correct XML document, in other case it will show description of XML parsing error


Answer posted on Nov 23, 2007 06:11

Thank you for your reply.

I've now found out that the problem is only in Firefox. There I get the "Incorrect XML" message.
But in Internet Explorer it works correctly: the autocomplete mode works just fine in that browser.

And when I point my browsers to the XML generating ASP script page directly, I get a correct XML display in Internet Explorer.
But in Firefox it displays as regular text instead of as a XML layout.

Any ideas?

Regards, Marja

Answer posted on Nov 23, 2007 06:18

Found it!
I 've now put Response.ContentType = "text/xml" in the ASP script that produces the XML, and it is now working correctly in FF as well.

Thanks for your help!

Regards, Marja