数据流任务,XML 源错误

发布于 2024-09-14 14:32:48 字数 5307 浏览 5 评论 0原文

我正在使用 VS 和 SQL Server 2008 开发 SSIS 应用程序。但是,我对 SSIS 仍然很陌生。

我已成功创建一个项目,其中的 XML 任务连接到数据流任务。但作为同一解决方案的一部分,我创建了一个相同的项目,其中 XML 任务连接到数据流任务。

据我所知,这两个项目之间的唯一区别是文件。尽管第一个包工作顺利,但第二个包失败并出现以下错误:

Error: 0xC02090FB at Data Flow Task, XML Source [1]: The "component "XML Source" (1)" failed because error code 0x80131537 occurred, and the error row disposition on "output column "WITHDRAWAL_DATE" (1689)" at "output "row" (28)" specifies failure on error. An error occurred on the specified object of the specified component.
Error: 0xC02092AF at Data Flow Task, XML Source [1]: The component "XML Source" (1) was unable to process the XML data. Pipeline component has returned HRESULT error code 0xC02090FB from a method call.

但是,我检查了这些文件,但看不出问题出在哪里。我该如何调试这个?输入 XML 文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<rows xmlns="http://www.w3.org/1999/xhtml">
  <row OTHER_ID="100041" GRAD_YR="2011" LAST_NAME="VALENTO" FIRST_NAME="SARA" MIDDLE_NAME="JEAN" BIRTHDATE="1993-01-30" DISTRICT_CODE="" STUDENT_STATUS="A" STUDENT_ID="10172" ALPHAKEY="VALENSAR000" SCHOOL_ID="010" ADVISOR="0" EW_DATE="2007-07-03" ENTRYC_CODE="00" WITHDRAWAL_DATE="2007-08-31" WITHDRAWAL_CODE="99" WITHDRAWAL_SCHOOL_YEAR="2008" WITHDRAWAL_GRAD_YR="2011" X_WITHDRAWAL_RETAINED="false" CY_TEAM_SCHD_ID="" GRADUATED="false" MN_EDE_NBR="624000665509">
  </row>
  <row OTHER_ID="100041" GRAD_YR="2011" LAST_NAME="VALENTO" FIRST_NAME="SARA" MIDDLE_NAME="JEAN" BIRTHDATE="1993-01-30" DISTRICT_CODE="" STUDENT_STATUS="A" STUDENT_ID="10172" ALPHAKEY="VALENSAR000" SCHOOL_ID="010" ADVISOR="0" EW_DATE="2008-07-08" ENTRYC_CODE="00" WITHDRAWAL_DATE="2008-07-24" WITHDRAWAL_CODE="99" WITHDRAWAL_SCHOOL_YEAR="2009" WITHDRAWAL_GRAD_YR="2011" X_WITHDRAWAL_RETAINED="false" CY_TEAM_SCHD_ID="" GRADUATED="false" MN_EDE_NBR="624000665509">
  </row>
  <row OTHER_ID="100041" GRAD_YR="2011" LAST_NAME="VALENTO" FIRST_NAME="SARA" MIDDLE_NAME="JEAN" BIRTHDATE="1993-01-30" DISTRICT_CODE="" STUDENT_STATUS="A" STUDENT_ID="10172" ALPHAKEY="VALENSAR000" SCHOOL_ID="010" ADVISOR="0" EW_DATE="2009-07-07" ENTRYC_CODE="24" WITHDRAWAL_DATE="2009-08-06" WITHDRAWAL_CODE="99" WITHDRAWAL_SCHOOL_YEAR="2010" WITHDRAWAL_GRAD_YR="2011" X_WITHDRAWAL_RETAINED="false" CY_TEAM_SCHD_ID="" GRADUATED="false" MN_EDE_NBR="624000665509">
  </row>

我的 XSD 文件如下所示:

<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" 
targetNamespace="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="rows">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="row">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="OTHER_ID" type="xs:string" use="optional" />
                <xs:attribute name="GRAD_YR" type="xs:decimal" use="optional" />
                <xs:attribute name="LAST_NAME" type="xs:string" use="optional" />
                <xs:attribute name="FIRST_NAME" type="xs:string" use="optional" />
                <xs:attribute name="MIDDLE_NAME" type="xs:string" use="optional" />
                <xs:attribute name="BIRTHDATE" type="xs:date" use="optional" />
                <xs:attribute name="DISTRICT_CODE" type="xs:string" use="optional" />
                <xs:attribute name="STUDENT_STATUS" type="xs:string" use="optional" />

                <xs:attribute name="STUDENT_ID" type="xs:integer" use="optional" />
                <xs:attribute name="ALPHAKEY" type="xs:string" use="optional" />
                <xs:attribute name="SCHOOL_ID" type="xs:string" use="optional" />
                <xs:attribute name="ADVISOR" type="xs:integer" use="optional" />
                <xs:attribute name="EW_DATE" type="xs:date" use="optional" />
                <xs:attribute name="ENTRYC_CODE" type="xs:string" use="optional" />
                <xs:attribute name="WITHDRAWAL_DATE" type="xs:dateTime" use="optional" />
                <xs:attribute name="WITHDRAWAL_CODE" type="xs:string" use="optional" />
                <xs:attribute name="WITHDRAWAL_SCHOOL_YEAR" type="xs:integer" use="optional" />
                <xs:attribute name="WITHDRAWAL_GRAD_YR" type="xs:integer" use="optional" />
<xs:attribute name="X_WITHDRAWAL_RETAINED" type="xs:boolean" use="optional" />
                <xs:attribute name="CY_TEAM_SCHD_ID" type="xs:string" use="optional" />
                <xs:attribute name="GRADUATED" type="xs:boolean" use="optional" />
                <xs:attribute name="MN_EDE_NBR" type="xs:decimal" use="optional" />

              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

此外,当我忽略此输出错误时,包执行开始,但随后因不同的错误而失败:

conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value

I am developing an SSIS application with VS and SQL Server 2008. I am still new to SSIS, however.

I have successfully created one project with an XML Task connected to a Data Flow Task. But as part of this same solution I created an identical project with XML Task connected to Data Flow Task.

From what I can see, the only difference between the two projects is the files. Although the first package worked smoothly, this second one fails with the following error:

Error: 0xC02090FB at Data Flow Task, XML Source [1]: The "component "XML Source" (1)" failed because error code 0x80131537 occurred, and the error row disposition on "output column "WITHDRAWAL_DATE" (1689)" at "output "row" (28)" specifies failure on error. An error occurred on the specified object of the specified component.
Error: 0xC02092AF at Data Flow Task, XML Source [1]: The component "XML Source" (1) was unable to process the XML data. Pipeline component has returned HRESULT error code 0xC02090FB from a method call.

However, I examined these files and cannot see where the problem lies. How can I debug this? The input XML file looks like:

<?xml version="1.0" encoding="utf-8"?>
<rows xmlns="http://www.w3.org/1999/xhtml">
  <row OTHER_ID="100041" GRAD_YR="2011" LAST_NAME="VALENTO" FIRST_NAME="SARA" MIDDLE_NAME="JEAN" BIRTHDATE="1993-01-30" DISTRICT_CODE="" STUDENT_STATUS="A" STUDENT_ID="10172" ALPHAKEY="VALENSAR000" SCHOOL_ID="010" ADVISOR="0" EW_DATE="2007-07-03" ENTRYC_CODE="00" WITHDRAWAL_DATE="2007-08-31" WITHDRAWAL_CODE="99" WITHDRAWAL_SCHOOL_YEAR="2008" WITHDRAWAL_GRAD_YR="2011" X_WITHDRAWAL_RETAINED="false" CY_TEAM_SCHD_ID="" GRADUATED="false" MN_EDE_NBR="624000665509">
  </row>
  <row OTHER_ID="100041" GRAD_YR="2011" LAST_NAME="VALENTO" FIRST_NAME="SARA" MIDDLE_NAME="JEAN" BIRTHDATE="1993-01-30" DISTRICT_CODE="" STUDENT_STATUS="A" STUDENT_ID="10172" ALPHAKEY="VALENSAR000" SCHOOL_ID="010" ADVISOR="0" EW_DATE="2008-07-08" ENTRYC_CODE="00" WITHDRAWAL_DATE="2008-07-24" WITHDRAWAL_CODE="99" WITHDRAWAL_SCHOOL_YEAR="2009" WITHDRAWAL_GRAD_YR="2011" X_WITHDRAWAL_RETAINED="false" CY_TEAM_SCHD_ID="" GRADUATED="false" MN_EDE_NBR="624000665509">
  </row>
  <row OTHER_ID="100041" GRAD_YR="2011" LAST_NAME="VALENTO" FIRST_NAME="SARA" MIDDLE_NAME="JEAN" BIRTHDATE="1993-01-30" DISTRICT_CODE="" STUDENT_STATUS="A" STUDENT_ID="10172" ALPHAKEY="VALENSAR000" SCHOOL_ID="010" ADVISOR="0" EW_DATE="2009-07-07" ENTRYC_CODE="24" WITHDRAWAL_DATE="2009-08-06" WITHDRAWAL_CODE="99" WITHDRAWAL_SCHOOL_YEAR="2010" WITHDRAWAL_GRAD_YR="2011" X_WITHDRAWAL_RETAINED="false" CY_TEAM_SCHD_ID="" GRADUATED="false" MN_EDE_NBR="624000665509">
  </row>

And my XSD file looks like:

<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" 
targetNamespace="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="rows">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="row">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="OTHER_ID" type="xs:string" use="optional" />
                <xs:attribute name="GRAD_YR" type="xs:decimal" use="optional" />
                <xs:attribute name="LAST_NAME" type="xs:string" use="optional" />
                <xs:attribute name="FIRST_NAME" type="xs:string" use="optional" />
                <xs:attribute name="MIDDLE_NAME" type="xs:string" use="optional" />
                <xs:attribute name="BIRTHDATE" type="xs:date" use="optional" />
                <xs:attribute name="DISTRICT_CODE" type="xs:string" use="optional" />
                <xs:attribute name="STUDENT_STATUS" type="xs:string" use="optional" />

                <xs:attribute name="STUDENT_ID" type="xs:integer" use="optional" />
                <xs:attribute name="ALPHAKEY" type="xs:string" use="optional" />
                <xs:attribute name="SCHOOL_ID" type="xs:string" use="optional" />
                <xs:attribute name="ADVISOR" type="xs:integer" use="optional" />
                <xs:attribute name="EW_DATE" type="xs:date" use="optional" />
                <xs:attribute name="ENTRYC_CODE" type="xs:string" use="optional" />
                <xs:attribute name="WITHDRAWAL_DATE" type="xs:dateTime" use="optional" />
                <xs:attribute name="WITHDRAWAL_CODE" type="xs:string" use="optional" />
                <xs:attribute name="WITHDRAWAL_SCHOOL_YEAR" type="xs:integer" use="optional" />
                <xs:attribute name="WITHDRAWAL_GRAD_YR" type="xs:integer" use="optional" />
<xs:attribute name="X_WITHDRAWAL_RETAINED" type="xs:boolean" use="optional" />
                <xs:attribute name="CY_TEAM_SCHD_ID" type="xs:string" use="optional" />
                <xs:attribute name="GRADUATED" type="xs:boolean" use="optional" />
                <xs:attribute name="MN_EDE_NBR" type="xs:decimal" use="optional" />

              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Furthermore, when I ignore this output error, package execution begins but then it fails on a different error:

conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一笔一画续写前缘 2024-09-21 14:32:48

在您的 XML 架构中,您已定义属性 WITHDRAWAL_DATE 的类型为 xs:date。这意味着 WITHDRAWAL_DATE 的内容必须采用 YYYY-MM-DDThh:mm:ss 格式。您的 XML 代码具有格式为 YYYY-DD-MMWITHDRAWAL_DATE 属性值。因此,根据您的架构,这些值无效,并且使用此类值创建 XML 文档将创建无效的 XML 文档。

XML 模式没有格式为 YYYY-DD-MM 的内置数据类型,因此您需要更改在 XML 文档中使用的格式,或者自己定义此属性的有效类型你的架构。

In your XML Schema you have defined that the type of the attribute WITHDRAWAL_DATE is xs:date. This means that the contents of WITHDRAWAL_DATE must be in format YYYY-MM-DDThh:mm:ss. Your XML code has WITHDRAWAL_DATE attribute values that are in format YYYY-DD-MM. Therefore these values are not valid according to your schema and creating a XML document with such values would create an invalid XML document.

XML Schema does not have a built-in datatype that has the format YYYY-DD-MM so you either need to change the format you use in your XML documents or define yourself the valid type for this attribute in your schema.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文