2013-11-15 36 views
1

我有多個名稱空間XML文件作爲源。我必須將所有名稱空間屬性值存儲在DW的單個表中,如何在SSIS中使用多個名稱空間文件

任何人都可以建議如何將該類型的文件用作源?

+0

lookie here http://social.msdn.microsoft.com/Forums/en-US/2fde216c-01ab-42a5-8b43-52f5f42d35bc/multiple-namespaces-in-an-xml-document – TsSkTo

+0

實際上,我已閱讀本文。但是,當我刪除命名空間,然後它顯示我一個多輸出並刪除鏈接屬性。 –

回答

3

我最近遇到這個問題,所以想到我會發表一些關於如何解決這個問題的筆記。在嘗試加載多名稱空間XML文檔之前,首先需要使用XSLT轉換進行轉換。 SSIS可以通過XML任務來完成。

拉從工具欄中的XML任務,並把它放在你的控制流

enter image description here

創建文件系統的一個新的XSLT文件,並使用下面的代碼作爲內容:

<?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/2013/XSL/Transform"> <xsl:output method="xml" indent="no" /> <xsl:template match="/|comment()|processing-instruction()"> <xsl:copy> <xsl:apply-templates /> </xsl:copy> </xsl:template> <xsl:template match="*"> <xsl:element name="{local-name()}"> <xsl:apply-templates select="@*|node()" /> </xsl:element> </xsl:template> <xsl:template match="@*"> <xsl:attribute name="{local-name()}"> <xsl:value-of select="." /> </xsl:attribute> </xsl:template> </xsl:stylesheet>

打開XML任務並設置以下屬性。

  • 操作類型= XSLT
  • SourceType中的FileConnection =
  • 源=這是設置爲您爲導入文件中設置 源文件連接。
  • SaveOperationResults =真
  • DestinationType =文件
  • 目的地=已設置了爲目標文件
  • OverwriteDestination =設爲優選
  • SecondOperandType =文件連接
  • 第二操作數=文件的文件連接該被設置爲保持上述XSLT代碼

enter image description here

一旦這些項目被添加到你的包,你應該能夠運行它,它將生成第二個文件的命名空間被刪除。

相關問題