IE8错误“有多个根元素”用于简单字符串返回MVC请求映射

时间:2011-12-06 19:22:43

标签: java javascript xml spring internet-explorer-8

我编写了一个简单的Spring MVC请求映射控制器,旨在向我的页面添加分析javascript代码。控制器将脚本代码作为简单字符串返回,该字符串作为IFrame的源添加到页面中。这几乎适用于所有浏览器Chrome,Firefox,IE6 / 7/9,但不适用于IE8。

每当页面点击请求映射时,会出现弹出窗口,表示无法启动应用程序。 在弹出的单击详细信息按钮上,将显示以下错误文本 -

PLATFORM VERSION INFO
Windows             : 6.1.7601.65536 (Win32NT)
Common Language Runtime     : 4.0.30319.239
System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll             : 4.0.30319.239 (RTMGDR.030319-2300)
dfdll.dll           : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll          : 4.0.31106.0 (Main.031106-0000)

SOURCES
    Deployment url          : http://myhost/getomniturescript?eventType=addToCart&user=null

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of http://myhost/getomniturescript?eventType=addToCart&user=null resulted in exception. Following failure messages were detected:
        + Exception reading manifest from http://myhost/getomniturescript?eventType=addToCart&user=null: the manifest may not be valid or the file could not be opened.
        + There are multiple root elements. Line 6, position 2.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [12/7/2011 12:10:33 AM] : Activation of http://myhost/getomniturescript?eventType=addToCart&user=null has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [12/7/2011 12:10:33 AM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
        - Exception reading manifest from http://myhost/getomniturescript?eventType=addToCart&user=null: the manifest may not be valid or the file could not be opened.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
        --- Inner Exception ---
        System.Xml.XmlException
        - There are multiple root elements. Line 6, position 2.
        - Source: System.Xml
        - Stack trace:
            at System.Xml.XmlTextReaderImpl.Throw(Exception e)
            at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
            at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
            at System.Xml.XmlTextReaderImpl.Read()
            at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read()
            at System.Xml.XmlCharCheckingReader.Read()
            at System.Xml.XsdValidatingReader.Read()
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

不知道IE8看到什么是重复的路由节点(其他浏览器似乎并不在乎),但这是请求映射方法返回的脚本 -

<script type="text/javascript" src="http://myhost/js/48B5AF20683B121371522205E132D314/omniture/sd_scode.js"></script>
<!-- SiteCatalyst code version: H.23.4.
Copyright 1996-2011 Adobe, Inc. All Rights Reserved
More info available at http://www.omniture.com -->
<script language="JavaScript" type="text/javascript"><!--
/* You may give each page an identifying name, server, and channel on
the next lines. */
s.pageName="addToCart"
s.server=""
s.channel="shoppingCart"
s.pageType=""
/* Conversion Variables */
s.campaign=""
s.state=""
s.zip=""
s.events="scAdd"
s.products="${catalogId}"
s.eVar44="null"
/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code)//--></script>
<script language="JavaScript" type="text/javascript"><!--
if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'!-'+'-')
//--></script><noscript><img src="http://somehost/b/ss/somedev/1/H.23.4--NS/0"
height="1" width="1" border="0" alt="" /></noscript><!--/DO NOT REMOVE/-->
<!-- End SiteCatalyst code version: H.23.4. -->

我尝试从控制器方法返回一个空的<script type="text/javascript" ></script> scriplet,但我仍然弹出一个,错误摘要已更改为 -

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of http://myhost/getomniturescript?eventType=showCart&user=null resulted in exception. Following failure messages were detected:
        + Exception reading manifest from http://myhost/getomniturescript?eventType=showCart&user=null: the manifest may not be valid or the file could not be opened.
        + Parsing and DOM creation of the manifest resulted in error. Following parsing errors were noticed: 
            -HRESULT:   0x8007001f
             Start line:    0
             Start column:  0
             Host file:     
        + A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)

我尝试直接从网络浏览器的地址栏点击控制器,而不是通过页面,结果保持不变。这意味着该错误与IFrame或添加脚本的页面无关。该脚本在开头有一个空行,这意味着第6行第2行的位置是第二个脚本标记的开头。

看起来脚本存在一些问题,使其与IE8不兼容。为什么IE8试图将其作为应用程序打开呢?

我真的很坚持,任何帮助都将不胜感激。

此致

图莎尔

1 个答案:

答案 0 :(得分:0)

所以这里的问题不在于我在页面上放置的脚本。问题不在于逻辑。我通过JQuery将控制器的调用更改为异步AJAX调用,并且工作正常。