0

我不知道这个问题是什么,这是一个非常简单的功能,当我关闭 SSIS 中的编辑器时,我收到“意外的结束标记,第 95 行,第 87 位,(mscorlib)”错误。一旦我收到此错误,我将无法再打开脚本任务来编辑代码。我在几台机器上试过这个。它要么使 SSIS 崩溃,要么给我一个错误。

Function XMLWrapper(ByVal name As String, ByVal value As String, ByVal cdata As Boolean) As String
    Dim Result As String
    If value.Length > 0 Then
        If cdata = True Then
            Result = vbTab & "<field name=" & name & "><![CDATA[" & value & "]]></field>"
        Else '<-- Line 95 where i get the error
            Result = vbTab & "<field name=" & name & ">" & value & "</field>"
        End If
    Else
        Result = ""
    End If
    Return Result
End Function
4

1 回答 1

0

This error is actually being thrown by saving the code into the XML SSIS package!

You can fool it by splitting your strings like so

    XMLResult = Replace(XMLResult, "URL>", "URL" & ">" & "<" & "![CDATA")

    XMLResult = Replace(XMLResult, "<" & "/" & "JobDetailURL" & ">", "]]" & ">" & "<" & "/" & "JobDetailURL" & ">")
    XMLResult = Replace(XMLResult, "<" & "/" & "CompanyURL" & ">", "]]" & ">" & "<" & "/" & "CompanyURL" & ">")
    XMLResult = Replace(XMLResult, "<" & "/" & "CompanyImageURL" & ">", "]]" & ">" & "<" & "/" & "CompanyImageURL" & ">")
于 2017-03-03T09:33:44.153 回答