2012-02-28 2 views
1

다음과 같은 정보를 얻을 수있는 사람이 있는지 궁금합니다. 저는 매주 값을 포함하는 텍스트 값을 가진 XML 파일을 가지고 있습니다. 저는 매주 데이터베이스에 별도의 행을 넣고 싶습니다.SSIS 분할 XML 텍스트

저는 SSIS를 사용하여 XML 파일을 데이터베이스에 저장하는 방법을 알고 있지만 텍스트 값 분할을 시작하는 방법에 대한 도움이 필요합니다.

감사합니다.

<DATA> 
<TIME-SERIES last-update-time="507340800" name="yearly" sample-interval="604800" observations="52" parent="http:client-volume">143 161 175 112 176 191 188 163 268 303 261 270 264 182 318 307 339 310 328 338 407 485 3330 274 168 191 179 258 183 256 258 238 2625 235 305 274 255 273 367 188 318 230 315 278 192 222 1268 129 150 350 3278 4757 </TIME-SERIES> 
</DATA> 

date  | name | interval | observation | parent    | value 
507340800 | yearly | 604800 | 52   | http:client-volume | 143 
507340800 | yearly | 604800 | 52   | http:client-volume | 161 
507340800 | yearly | 604800 | 52   | http:client-volume | 175 
+0

무엇을해야 같은 위의보기의 출력? – billinkc

+0

@billinkc 원본 게시물보기, 방금 편집했습니다. – Bas

답변

0

어떻게 그것에 대해 약간의 XSL 조각을 작성에 대한 선호 출력? 는 여기에 내가 실행, 해낸 하나 : xsltproc MY_XSL_FILE YOUR_XML_FILE

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:s="http://exslt.org/strings" 
    version="1.0"> 

    <xsl:output method="text"/> 

    <xsl:template match="text()"/> 

    <xsl:template match="TIME-SERIES"> 
    <xsl:variable name="last-update-time" select="@last-update-time"/> 
    <xsl:variable name="name" select="@name"/> 
    <xsl:variable name="sample-interval" select="@sample-interval"/> 
    <xsl:variable name="observations" select="@observations"/> 
    <xsl:variable name="parent" select="@parent"/> 

    <!-- heading --> 
    <xsl:text>date  | name | interval | observation | parent    | value&#0010;</xsl:text> 

    <xsl:for-each select="s:tokenize(text(), ' ')"> 
     <xsl:value-of select="$last-update-time"/> 
     <xsl:text> | </xsl:text> 
     <xsl:value-of select="$name"/> 
     <xsl:text> | </xsl:text> 
     <xsl:value-of select="$sample-interval"/> 
     <xsl:text> | </xsl:text> 
     <xsl:value-of select="$observations"/> 
     <xsl:text>   | </xsl:text> 
     <xsl:value-of select="$parent"/> 
     <xsl:text> | </xsl:text> 
     <xsl:value-of select="."/> 
     <xsl:text>&#0010;</xsl:text> 
    </xsl:for-each> 
    </xsl:template> 

</xsl:stylesheet>