简体   繁体   中英

What does Firebug “XML cannot be the whole program” error message mean?

I just got this error message in Firebug. A google search reveals nothing but other mystified people! Does anyone have any idea what it means?

It's being indicated on the last line of this 3-line script:

<script>
    g_BuildServer = "/";
</script>

If you put JavaScript in a js file (which I assume you did), do NOT put the script tags, put

g_BuildServer = "/";

only.

Otherwise, to the parser, you just provided an XML document as a script.

I got this error when using jquery $get with no data type attribute when it was retrieving html. I added the dataType parameter as "html" and it fixed the issue.

Happened to me too, just for having an empty script tag in the page. When I removed this:

<script src="" type="text/javascript"></script>

everything got back to normal..

I got the "XML cannot be the whole program" error because the server was returning an xml error message in response to a request for a javascript file. My case may be unusual, but here it is:

I had a servlet filter granting or denying access to server resources. If it grants access, you get the resource, otherwise, you get <filterResponse><Access_Denied/></filterResponse> . I had failed to add the javascript file to the list of resources you don't have to be logged in to access. So, when Firefox received an XML error message as the body of a javascript program, its complaint makes perfect sense.

当我在我的javascript中发表评论时遇到了这个错误,但它没有以/ *开头它只是有几个*因此创建语法错误

Also you can get this error while you use jQuery. In that case replace "$" with "jQuery"

当您使用jQuery的模板插件并将标记放在脚本标记中时,也会发生这种情况,但是您忘记将脚本标记的type属性更改为'text / x-jquery-tmpl'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM