【问题标题】:SSIS Script Task - How to store xml content in project parameter and refer it in Script TaskSSIS 脚本任务 - 如何在项目参数中存储 xml 内容并在脚本任务中引用它
【发布时间】:2019-07-31 19:36:31
【问题描述】:

我有一个包含以下内容的 XML

<?xml version ="1.0"?>
<tables>
 <table id = "1">A</table>
 <table id = "2">B</table>
</tables>

我在脚本任务中引用项目参数内的 XML 内容,即

但我得到了错误

路径中有非法字符

并且在执行包时 XML 未加载错误。我在脚本任务中使用的以下行:

XElement xe = XElement.Load(Dts.Variables["$Project::pXML].Value.ToString());

请建议我需要做出哪些改变。

【问题讨论】:

    标签: xml ssis


    【解决方案1】:

    你应该使用XElement.Parse(...) 它从字符串加载 XML。

    【讨论】:

      【解决方案2】:

      我认为你应该使用XmlDocument 而不是XElement

      XmlDocument xmlDoc = new XmlDocument();
      xmlDoc.LoadXml(Dts.Variables["$Project::pXML"].Value.ToString());
      

      【讨论】:

        猜你喜欢
        • 2023-03-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多