0
votes

I'm trying to use SQL Server 2008 SSIS to read an XML file and put it into a database, but I'm having problems. Everything is green when I run debugging, but no data is actually transferred. Even when a make a simple XML Source -> Flat File output, the flat file is blank after being created.

I'm using the inline schema, but even if I remove the schema SSIS can't generate an XSD file.

Here's the XML:

<?xml version="1.0" encoding="utf-16"?>
<DataSet>
  <xs:schema id="Schedule_x0020_Set" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="Schedule_x0020_Set" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Schedule_x0020_Table">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="ScheduleDate" type="xs:string" minOccurs="0" />
                <xs:element name="StaffLName" type="xs:string" minOccurs="0" />
                <xs:element name="StaffFName" type="xs:string" minOccurs="0" />
                <xs:element name="TaskName" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
    <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
    <Schedule_x0020_Set>
      <Schedule_x0020_Table diffgr:id="Schedule Table1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
        <ScheduleDate>1/24/2011</ScheduleDate>
        <StaffLName>Smith</StaffLName>
        <StaffFName>Josh</StaffFName>
        <TaskName>Day Shift</TaskName>
      </Schedule_x0020_Table>
      <Schedule_x0020_Table diffgr:id="Schedule Table2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
        <ScheduleDate>1/24/2011</ScheduleDate>
        <StaffLName>Doe</StaffLName>
        <StaffFName>Jane</StaffFName>
        <TaskName>Night Shift</TaskName>
      </Schedule_x0020_Table>
      <Schedule_x0020_Table diffgr:id="Schedule Table3" msdata:rowOrder="2" diffgr:hasChanges="inserted">
        <ScheduleDate>1/24/2011</ScheduleDate>
        <StaffLName>Johnson</StaffLName>
        <StaffFName>Barbara</StaffFName>
        <TaskName>Off</TaskName>
      </Schedule_x0020_Table>
    </Schedule_x0020_Set>
  </diffgr:diffgram>
</DataSet>
1

1 Answers

0
votes

I had to use the following file to get it to work. It only began to work when I changed the schema AND removed the diffgr stuff. Hope this helps.

<DataSet>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="DataSet">
<xs:complexType>
<xs:sequence>
<xs:element ref="Schedule_x0020_Set"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Schedule_x0020_Set">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Schedule_x0020_Table"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Schedule_x0020_Table">
<xs:complexType>
<xs:sequence>
<xs:element ref="ScheduleDate"/>
<xs:element ref="StaffLName"/>
<xs:element ref="StaffFName"/>
<xs:element ref="TaskName"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ScheduleDate" type="xs:string"/>
<xs:element name="StaffLName" type="xs:NCName"/>
<xs:element name="StaffFName" type="xs:NCName"/>
<xs:element name="TaskName" type="xs:string"/>
</xs:schema>
<Schedule_x0020_Set>
<Schedule_x0020_Table>
<ScheduleDate>1/24/2011</ScheduleDate>
<StaffLName>Smith</StaffLName>
<StaffFName>Josh</StaffFName>
<TaskName>Day Shift</TaskName>
</Schedule_x0020_Table>
<Schedule_x0020_Table>
<ScheduleDate>1/24/2011</ScheduleDate>
<StaffLName>Doe</StaffLName>
<StaffFName>Jane</StaffFName>
<TaskName>Night Shift</TaskName>
</Schedule_x0020_Table>
<Schedule_x0020_Table>
<ScheduleDate>1/24/2011</ScheduleDate>
<StaffLName>Johnson</StaffLName>
<StaffFName>Barbara</StaffFName>
<TaskName>Off</TaskName>
</Schedule_x0020_Table>
</Schedule_x0020_Set>
</DataSet>