简体   繁体   English

SSIS从文件夹读取多个XML文件

[英]SSIS Reading Multiple XML Files From a Folder

There is already an excellent answer to this question posted Previous Answer , and it almost works as advertised, but I have one problem. 已经有一个很好的回答这个问题贴前面的答案 ,它几乎像宣传的那样,但我有一个问题。 In the example the author creates a "For Each File Enumerator" and a loop variable to hold the XML file name. 在示例中,作者创建了一个“ For Each File Enumerator”和一个循环变量来保存XML文件名。 The value of this variable is left as an empty string. 该变量的值保留为空字符串。

I find that I must put a valid initial value in that variable. 我发现我必须在该变量中输入一个有效的初始值。 If I do not, I get this error: Validation Error. 如果不这样做,则会出现以下错误:验证错误。 Import XML Serialization File: The property "XMLDataVariable" on the Read XML Serialization File was empty" 导入XML序列化文件:“读取XML序列化文件”上的属性“ XMLDataVariable”为空”

If I put in a valid initial value, the package executes correctly. 如果输入有效的初始值,则程序包将正确执行。 This is superfluous, but if I then put a new set of XML files in the folder to be imported without changing the initial value I get this error when I execute the package: Package Validation Error. 这是多余的,但是如果我随后在不更改初始值的情况下将新的XML文件集放入要导入的文件夹中,则在执行程序包时收到以下错误消息:程序包验证错误。 The file text specifying my particular file here was not found. 找不到指定我特定文件的文件文本 Please verify the path and try again. 请验证路径,然后重试。

I suspect I have something set up incorrectly, but I'm new to SSIS and I'm not sure where to look. 我怀疑我的设置不正确,但是我是SSIS的新手,所以不确定在哪里看。 Thanks for any help. 谢谢你的帮助。

I followed the instructions from the previous answer in Visual Studio 2008 and I was not able to reproduce the error your are receiving. 我按照Visual Studio 2008中上一个答案的说明进行操作,但无法重现您收到的错误。 Here are a few things to try: 这里有一些尝试:

  • Open the XML Source component properties and make sure your XMLDataVariable is pointing to your User::FilePath variable: 打开XML Source组件属性,并确保XMLDataVariable指向User :: FilePath变量:

    XML Source属性

  • If you set the initial value of your User::FilePath variable to blank, the XML Source component will fail if you execute it directly (by right clicking on the data flow it is in and choosing "Execute Task"). 如果将User :: FilePath变量的初始值设置为空,则直接执行XML Source组件将失败(通过右键单击它所在的数据流并选择“ Execute Task”)。 If you instead execute your whole package - and everything is configured correctly - then you should not get the error. 如果改为执行整个程序包-且所有配置均正确-那么您不应收到该错误。

  • You can try setting the "ValidateExternalMetadata" property of your XML Source component to False. 您可以尝试将XML Source组件的“ ValidateExternalMetadata”属性设置为False。 In my case I don't need to do this, but if your package is configured slightly differently it might help. 就我而言,我不需要这样做,但是如果您的软件包配置略有不同,则可能会有所帮助。

将XML源的DelayValidation属性设置为True ,这应该可以解决您的问题

DelayValidation属性从False设置True以后 ,我就可以为XML文件解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM