faq:responseXML has no properties in firefox or responseXML is null

  • Errors reading XML data files
The errors "xmlDoc has no properties" may indicate slow server response or incorrect server MIME type setting. "documentElement is null or not an object" is usually caused by your server setting the wrong MIME type on your XML data file. If you can't change your server to set the MIME type to "text/xml" you can change your code to use "var xmlDoc = GXml.parse(request.responseText);" instead of "var xmlDoc = request.responseXML;". Also, an ampersand ('&') in the xml file may cause the xml file to behave as if it has no contents when trying to be read by the Google Map.

         以上内容摘自:http://mapki.com/index.php?title=FAQs
        意思:服务器输出类型不是xml型。我测试了以下asp 代码如下:
    <%@ language="jscript" codepage="65001"%>
<%
Response.charset="utf-8";
Response.ContentType="text/xml";
Response.Write("<?xml version='1.0' encoding='utf-8' ?>")
Response.Write("<root><name>a</name><name>b&amp;a</name></root>");
%>
  以上代码获取,在firefox下,也可以有ResponseXML的 [object XMLdocument]
   
  如果服务器类型是别的类型。请使用
   new DOMParser().parseFromString(req.responseText,'text/xml')

posted on 2006-10-03 15:31  清雨轩  阅读(687)  评论(0)    收藏  举报

导航