简单的vb函数崩溃SSIS并给出“未解决的结束标记错误”

时间:2013-09-06 14:59:01

标签: sql vb.net ssis

我不知道这个问题是什么,这是一个非常简单的功能,当我关闭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

1 个答案:

答案 0 :(得分:0)

通过将代码保存到XML SSIS包中实际上会抛出此错误!

你可以通过分割你的字符串来欺骗它

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

    XMLResult = Replace(XMLResult, "<" & "/" & "JobDetailURL" & ">", "]]" & ">" & "<" & "/" & "JobDetailURL" & ">")
    XMLResult = Replace(XMLResult, "<" & "/" & "CompanyURL" & ">", "]]" & ">" & "<" & "/" & "CompanyURL" & ">")
    XMLResult = Replace(XMLResult, "<" & "/" & "CompanyImageURL" & ">", "]]" & ">" & "<" & "/" & "CompanyImageURL" & ">")