首页 > 解决方案 > XML 源的问题

问题描述

我正在尝试使用 SSIS 包将数据从 XML 文件加载到 SQL Server 表,但是在执行它和数据流中的 XML 源时,它一直在给我这个错误。

如果我在不同的 PC 上使用相同的 XML 文件执行它,我会收到任何错误消息,但使用公司 PC 我会。

Error Message,
**Error 1**"The XML Source was unable to process the XML data. Object 
reference not set to an instance of an object."
**Error 2:**[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  
The PrimeOutput method on XML Source returned error code 0xC02092AF.  The 
component returned a failure code when the pipeline engine called 
PrimeOutput(). The meaning of the failure code is defined by the component, 
but the error is fatal and the pipeline stopped executing.  There may be 
error messages posted before this with more information about the failure.

是使用的 XML 文件:

我该如何解决这个问题?

标签: xmlssis-2012

解决方案


您的 xmlsource 文件不包含有效的 xml,这就是发生此错误的原因。使用以下 xml 数据。

  <?xml version="1.0" encoding="UTF-8"?>
    <counters>
      <counter>
         <extractDate>2007-12-O5</extractDate>
         <category>dispatcher</category>
         <name>server1</name>
         <runtime>6</runtime>
         <queue>3</queue>
         <maxrequest>8</maxrequest>
         <color>blue</color>
         <hostName>svo2555</hostName>
         <path>\\dispatcher</path>
         <lastaccessed>2007-O2-03</lastaccessed>
     </counter>
     <counter>
         <extractDate>2007-12-O5</extractDate>
         <category>gateway</category>
         <name>server1</name>
         <runtime>1</runtime>
         <queue>10</queue>
         <maxrequest>10</maxrequest>
         <color>purpIe</color>
         <hostName>svo2555</hostName>
         <path>\\gateway</path>
         <lastaccessed>2007-02-03</lastaccessed>
     </counter>
 </counters>

推荐阅读