gpt4 book ai didi

vb.net - xslt.Load(新 XmlTextReader(新 StringReader(xslt))) "xslt compile error"

转载 作者:行者123 更新时间:2023-12-04 02:59:06 31 4
gpt4 key购买 nike

我已经阅读了其他帖子,但它们没有解决我的问题。环境为VB 2008(2.0 Framework)下面的代码在 xslt.Load 行导致 XSLT 编译错误下面是错误的输出。我将 XSLT 作为字符串传递,所以不确定为什么会收到错误消息。

Public Function xFrmTlogs(ByVal sXLST As String, ByVal sXML As String) As String
Dim xslt As New XslCompiledTransform()
Dim HTMLoutput As String
Dim writer As New StringWriter()

Try
xslt.Load(New XmlTextReader(New StringReader(sXLST.ToString)))
Catch ex As Exception
xFrmTlogs = ex.ToString
End Try

Dim sourceReader As System.Xml.XmlReader = System.Xml.XmlReader.Create(New System.IO.StringReader(sXML))

Try
xslt.Transform(sourceReader, Nothing, writer)
Catch ex As Exception
xFrmTlogs = ex.ToString
End Try

HTMLoutput = writer.ToString()
writer.Close()
xFrmTlogs = HTMLoutput
End Function

System.Xml.Xsl.XslLoadException: XSLT compile error. An error occurred at (3,2). --- System.IO.DirectoryNotFoundException: Could not find a part of the path 'H:\Program Files\common\tr_period.xsl'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) at System.Xml.Xsl.Xslt.XsltLoader.CreateReader(Uri uri, XmlResolver xmlResolver) at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(Uri uri, Boolean include) at System.Xml.Xsl.Xslt.XsltLoader.LoadInclude() at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include) --- End of inner exception stack trace --- at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include) at System.Xml.Xsl.Xslt.XsltLoader.Load(Compiler compiler, Object stylesheet, XmlResolver xmlResolver) at System.Xml.Xsl.Xslt.Compiler.Compile(Object stylesheet, XmlResolver xmlResolver, QilExpression& qil) at System.Xml.Xsl.XslCompiledTransform.CompileXsltToQil(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet) at VfiSapphire.COMWrapper.xFrmTlogs(String sXLST, String sXML) in H:\Documents and Settings\xxx\My Documents\Visual Studio2008\ProgramName\ModuleName\PdkBo.vb:line 709

最佳答案

存储在 sXSLT 中的 XSLT 脚本可能包含 <xsl:include><xsl:import>试图包含/导入位于 H:\Program Files\common\tr_period.xsl 的另一个 XSLT 脚本文件的元素.由于该文件不存在或无法访问,因此转换失败。

关于vb.net - xslt.Load(新 XmlTextReader(新 StringReader(xslt))) "xslt compile error",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13672823/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com