【发布时间】:2020-05-11 13:42:52
【问题描述】:
我正在尝试进行服务器端 xml 转换并指定要在 global.asa 中使用的模板 对于我用 server.MapPath 指定的路径。对于同一文件夹中的文件,找到了一些文件,其中一个给出了错误。知道为什么吗?
例如,找到了第一个,没有找到第二个 server.MapPath("/website_root/subFolder/XSL/A.xsl")
server.MapPath("/website_root/subFolder/XSL/B.xsl")
错误提示 msxml3.dll 错误“80070003” 系统找不到指定的路径
提前致谢。
编辑: 问题在于添加的新模板,同一文件夹中文件的旧声明显示正常。代码如下:
Dim oXSL, oXSLTemplateA, oXSLTemplateB, oXSLTemplateC, oXSLTemplateD, oXSLTemplateE
Set oXSL = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
'A.xsl
oXSL.load server.MapPath("projectRoot/SubFolder/XSL/A.xsl")
Set oXSLTemplateA = Server.CreateObject("Msxml2.XSLTemplate")
oXSLTemplateA.stylesheet = oXSL
Set Application("ATemplate") = oXSLTemplateA
'B.xsl
Set oXSL = Nothing
Set oXSL = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
oXSL.load server.MapPath("/projectRoot/SubFolder/XSL/B.xsl")
Set oXSLTemplateB = Server.CreateObject("Msxml2.XSLTemplate")
oXSLTemplateB.stylesheet = oXSL 'ERROR ON THIS LINE
Set Application("BTemplate") = oXSLTemplateB
'C.xsl
Set oXSL = Nothing
Set oXSL = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
oXSL.load server.MapPath("/projectRoot/SubFolder2/XSL/C.xsl")
Set oXSLTemplateC = Server.CreateObject("Msxml2.XSLTemplate")
oXSLTemplateC.stylesheet = oXSL
Set Application("CTemplate") = oXSLTemplateC
'D.xsl
Set oXSL = Nothing
Set oXSL = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
oXSL.load server.MapPath("/projectRoot/SubFolder2/XSL/D.xsl")
Set oXSLTemplateD = Server.CreateObject("Msxml2.XSLTemplate")
oXSLTemplateD.stylesheet = oXSL
Set Application("DTemplate") = oXSLTemplateD
'E.xsl
Set oXSL = Nothing
Set oXSL = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
oXSL.load server.MapPath("/projectRoot/SubFolder2/XSL/E.xsl")
Set oXSLTemplateE = Server.CreateObject("Msxml2.XSLTemplate")
oXSLTemplateE.stylesheet = oXSL 'ERROR ON THIS LINE
Set Application("ETemplate") = oXSLTemplateE
编辑: 如果我将 E.xsl 更改为我知道不存在的随机名称。错误是不同的,它会说 msxml3.dll 错误 '80004005' 样式表不包含文档元素。样式表可能是空的,也可能不是格式良好的 XML 文档。
【问题讨论】:
-
权限?
-
我检查了两个文件都是一样的。
-
什么是
website_root?Server.MapPath中的路径应该是 after root,即如果您的 website_root 保留为 root,那么您调用Server.MapPath("/subFolder/XSL/A.xsl")。使用 Response.Write 调试代码并在 Server.MapPath 执行后输出完整路径。该消息清楚地表明它找不到路径。 -
这段代码在 global.asa 有没有办法从那里打印出一个语句?
-
@user2316116 取决于它是否被构建为我见过的子站点。不太好,但它确实发生了。