从xml架构中删除复杂类型。有人可以帮忙吗?

时间:2013-03-15 18:50:29

标签: xml

需要从此代码中删除复杂类型。有人可以帮忙吗我不断得到恐怖: 当我尝试在SSIS包中使用它时,XML Source适配器不支持混合内容或复杂类型

<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="AMRDEF">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" name="ScheduleExecution">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" name="ScheduleInfo">
                <xs:complexType>
                  <xs:attribute name="ServiceProvider" type="xs:string" use="optional" />
                  <xs:attribute name="Role" type="xs:string" use="optional" />
                  <xs:attribute name="Irn" type="xs:unsignedByte" use="optional" />
                  <xs:attribute name="Type" type="xs:unsignedByte" use="optional" />
                  <xs:attribute name="Tolerance" type="xs:unsignedShort" use="optional" />
                  <xs:attribute name="DestinationDir" type="xs:string" use="optional" />
                  <xs:attribute name="Name" type="xs:string" use="optional" />
                  <xs:attribute name="Description" type="xs:string" use="optional" />
                  <xs:attribute name="ObservesDst" type="xs:boolean" use="optional" />
                  <xs:attribute name="IsBilling" type="xs:boolean" use="optional" />
                  <xs:attribute name="TimeZoneIndex" type="xs:unsignedByte" use="optional" />
                  <xs:attribute name="Timezone" type="xs:string" use="optional" />
                  <xs:attribute name="TimeZoneOffset" type="xs:unsignedByte" use="optional" />
                </xs:complexType>
              </xs:element>
              <xs:element minOccurs="0" name="MetersNotRead">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="Meter">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element minOccurs="0" name="Status">
                            <xs:complexType>
                              <xs:attribute name="Code" type="xs:unsignedByte" use="optional" />
                              <xs:attribute name="Text" type="xs:string" use="optional" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="MeterIrn" type="xs:unsignedShort" use="optional" />
                        <xs:attribute name="MeterName" type="xs:string" use="optional" />
                        <xs:attribute name="IsActive" type="xs:boolean" use="optional" />
                        <xs:attribute name="SerialNumber" type="xs:string" use="optional" />
                        <xs:attribute name="MeterType" type="xs:string" use="optional" />
                        <xs:attribute name="Description" type="xs:string" use="optional" />
                        <xs:attribute name="InstallDate" type="xs:string" use="optional" />
                        <xs:attribute name="RemovalDate" type="xs:string" use="optional" />
                        <xs:attribute name="AccountIdent" type="xs:string" use="optional" />
                        <xs:attribute name="AccountName" type="xs:string" use="optional" />
                        <xs:attribute name="SdpIdent" type="xs:string" use="optional" />
                        <xs:attribute name="Location" type="xs:string" use="optional" />
                        <xs:attribute name="TimeZoneIndex" type="xs:unsignedByte" use="optional" />
                        <xs:attribute name="Timezone" type="xs:string" use="optional" />
                        <xs:attribute name="TimeZoneOffset" type="xs:unsignedShort" use="optional" />
                        <xs:attribute name="ObservesDaylightSavings" type="xs:boolean" use="optional" />
                        <xs:attribute name="MediaType" type="xs:string" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element minOccurs="0" name="MetersRead">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="Meter">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element minOccurs="0" name="Status">
                            <xs:complexType>
                              <xs:attribute name="Code" type="xs:unsignedByte" use="optional" />
                              <xs:attribute name="Text" type="xs:string" use="optional" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="MeterIrn" type="xs:unsignedShort" use="optional" />
                        <xs:attribute name="MeterName" type="xs:string" use="optional" />
                        <xs:attribute name="IsActive" type="xs:boolean" use="optional" />
                        <xs:attribute name="SerialNumber" type="xs:string" use="optional" />
                        <xs:attribute name="MeterType" type="xs:string" use="optional" />
                        <xs:attribute name="Description" type="xs:string" use="optional" />
                        <xs:attribute name="InstallDate" type="xs:string" use="optional" />
                        <xs:attribute name="RemovalDate" type="xs:string" use="optional" />
                        <xs:attribute name="AccountIdent" type="xs:string" use="optional" />
                        <xs:attribute name="AccountName" type="xs:string" use="optional" />
                        <xs:attribute name="SdpIdent" type="xs:string" use="optional" />
                        <xs:attribute name="Location" type="xs:string" use="optional" />
                        <xs:attribute name="TimeZoneIndex" type="xs:unsignedByte" use="optional" />
                        <xs:attribute name="Timezone" type="xs:string" use="optional" />
                        <xs:attribute name="TimeZoneOffset" type="xs:unsignedByte" use="optional" />
                        <xs:attribute name="ObservesDaylightSavings" type="xs:boolean" use="optional" />
                        <xs:attribute name="MediaType" type="xs:string" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element minOccurs="0" name="ErrorSection">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="Meter">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element minOccurs="0" name="Status">
                            <xs:complexType>
                              <xs:attribute name="Code" type="xs:unsignedByte" use="optional" />
                              <xs:attribute name="Text" type="xs:string" use="optional" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="MeterIrn" type="xs:unsignedShort" use="optional" />
                        <xs:attribute name="MeterName" type="xs:string" use="optional" />
                        <xs:attribute name="IsActive" type="xs:boolean" use="optional" />
                        <xs:attribute name="SerialNumber" type="xs:string" use="optional" />
                        <xs:attribute name="MeterType" type="xs:string" use="optional" />
                        <xs:attribute name="Description" type="xs:string" use="optional" />
                        <xs:attribute name="InstallDate" type="xs:string" use="optional" />
                        <xs:attribute name="RemovalDate" type="xs:string" use="optional" />
                        <xs:attribute name="AccountIdent" type="xs:unsignedInt" use="optional" />
                        <xs:attribute name="AccountName" type="xs:string" use="optional" />
                        <xs:attribute name="SdpIdent" type="xs:unsignedByte" use="optional" />
                        <xs:attribute name="Location" type="xs:string" use="optional" />
                        <xs:attribute name="TimeZoneIndex" type="xs:unsignedByte" use="optional" />
                        <xs:attribute name="Timezone" type="xs:string" use="optional" />
                        <xs:attribute name="TimeZoneOffset" type="xs:unsignedByte" use="optional" />
                        <xs:attribute name="ObservesDaylightSavings" type="xs:boolean" use="optional" />
                        <xs:attribute name="MediaType" type="xs:string" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element minOccurs="0" name="TamperSection">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="Meter">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element minOccurs="0" name="Status">
                            <xs:complexType>
                              <xs:attribute name="Code" type="xs:unsignedByte" use="optional" />
                              <xs:attribute name="Text" type="xs:string" use="optional" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="MeterIrn" type="xs:unsignedShort" use="optional" />
                        <xs:attribute name="MeterName" type="xs:string" use="optional" />
                        <xs:attribute name="IsActive" type="xs:boolean" use="optional" />
                        <xs:attribute name="SerialNumber" type="xs:string" use="optional" />
                        <xs:attribute name="MeterType" type="xs:string" use="optional" />
                        <xs:attribute name="Description" type="xs:string" use="optional" />
                        <xs:attribute name="InstallDate" type="xs:string" use="optional" />
                        <xs:attribute name="RemovalDate" type="xs:string" use="optional" />
                        <xs:attribute name="AccountIdent" type="xs:string" use="optional" />
                        <xs:attribute name="AccountName" type="xs:string" use="optional" />
                        <xs:attribute name="SdpIdent" type="xs:string" use="optional" />
                        <xs:attribute name="Location" type="xs:string" use="optional" />
                        <xs:attribute name="TimeZoneIndex" type="xs:unsignedByte" use="optional" />
                        <xs:attribute name="Timezone" type="xs:string" use="optional" />
                        <xs:attribute name="TimeZoneOffset" type="xs:unsignedByte" use="optional" />
                        <xs:attribute name="ObservesDaylightSavings" type="xs:boolean" use="optional" />
                        <xs:attribute name="MediaType" type="xs:string" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Irn" type="xs:unsignedByte" use="optional" />
            <xs:attribute name="started" type="xs:string" use="optional" />
            <xs:attribute name="finished" type="xs:string" use="optional" />
            <xs:attribute name="Initiator" type="xs:string" use="optional" />
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="MeterReadings">
          <xs:complexType>
            <xs:sequence>
              <xs:choice maxOccurs="unbounded">
                <xs:element minOccurs="0" name="Meter">
                  <xs:complexType>
                    <xs:attribute name="MeterIrn" type="xs:unsignedShort" use="optional" />
                    <xs:attribute name="MeterName" type="xs:string" use="optional" />
                    <xs:attribute name="IsActive" type="xs:boolean" use="optional" />
                    <xs:attribute name="SerialNumber" type="xs:string" use="optional" />
                    <xs:attribute name="MeterType" type="xs:string" use="optional" />
                    <xs:attribute name="Description" type="xs:string" use="optional" />
                    <xs:attribute name="InstallDate" type="xs:string" use="optional" />
                    <xs:attribute name="RemovalDate" type="xs:string" use="optional" />
                    <xs:attribute name="AccountIdent" type="xs:string" use="optional" />
                    <xs:attribute name="AccountName" type="xs:string" use="optional" />
                    <xs:attribute name="SdpIdent" type="xs:string" use="optional" />
                    <xs:attribute name="Location" type="xs:string" use="optional" />
                    <xs:attribute name="TimeZoneIndex" type="xs:unsignedByte" use="optional" />
                    <xs:attribute name="Timezone" type="xs:string" use="optional" />
                    <xs:attribute name="TimeZoneOffset" type="xs:unsignedByte" use="optional" />
                    <xs:attribute name="ObservesDaylightSavings" type="xs:boolean" use="optional" />
                    <xs:attribute name="MediaType" type="xs:string" use="optional" />
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" name="Clock">
                  <xs:complexType>
                    <xs:attribute name="MeterTime" type="xs:string" use="optional" />
                    <xs:attribute name="ServerTime" type="xs:string" use="optional" />
                    <xs:attribute name="DaylightAdjustmentInEffectAtMeter" type="xs:boolean" use="optional" />
                    <xs:attribute name="ActiveSeason" type="xs:string" use="optional" />
                    <xs:attribute name="ActiveTier" type="xs:string" use="optional" />
                    <xs:attribute name="ActiveDayType" type="xs:string" use="optional" />
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" name="ReadingQualityIndicator">
                  <xs:complexType>
                    <xs:attribute name="Name" type="xs:string" use="optional" />
                    <xs:attribute name="Value" type="xs:boolean" use="optional" />
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" maxOccurs="unbounded" name="ConsumptionData">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element minOccurs="0" name="ConsumptionSpec">
                        <xs:complexType>
                          <xs:attribute name="UOM" type="xs:string" use="optional" />
                          <xs:attribute name="Direction" type="xs:string" use="optional" />
                          <xs:attribute name="TouBucket" type="xs:string" use="optional" />
                          <xs:attribute name="MeasurementPeriod" type="xs:string" use="optional" />
                          <xs:attribute name="Multiplier" type="xs:decimal" use="optional" />
                        </xs:complexType>
                      </xs:element>
                      <xs:element minOccurs="0" name="Reading">
                        <xs:complexType>
                          <xs:attribute name="TimeStamp" type="xs:string" use="optional" />
                          <xs:attribute name="Value" type="xs:decimal" use="optional" />
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" maxOccurs="unbounded" name="MaxDemandData">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element minOccurs="0" name="MaxDemandSpec">
                        <xs:complexType>
                          <xs:attribute name="UOM" type="xs:string" use="optional" />
                          <xs:attribute name="Direction" type="xs:string" use="optional" />
                          <xs:attribute name="TouBucket" type="xs:string" use="optional" />
                          <xs:attribute name="MeasurementPeriod" type="xs:string" use="optional" />
                          <xs:attribute name="Multiplier" type="xs:decimal" use="optional" />
                        </xs:complexType>
                      </xs:element>
                      <xs:element minOccurs="0" name="Reading">
                        <xs:complexType>
                          <xs:attribute name="TimeStamp" type="xs:string" use="optional" />
                          <xs:attribute name="Value" type="xs:decimal" use="optional" />
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" maxOccurs="unbounded" name="CumulativeDemandData">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element minOccurs="0" name="CumulativeDemandSpec">
                        <xs:complexType>
                          <xs:attribute name="UOM" type="xs:string" use="optional" />
                          <xs:attribute name="Direction" type="xs:string" use="optional" />
                          <xs:attribute name="TouBucket" type="xs:string" use="optional" />
                          <xs:attribute name="MeasurementPeriod" type="xs:string" use="optional" />
                          <xs:attribute name="Multiplier" type="xs:decimal" use="optional" />
                        </xs:complexType>
                      </xs:element>
                      <xs:element minOccurs="0" name="Reading">
                        <xs:complexType>
                          <xs:attribute name="Value" type="xs:unsignedShort" use="optional" />
                          <xs:attribute name="TimeStamp" type="xs:string" use="optional" />
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" name="Message">
                  <xs:complexType>
                    <xs:attribute name="Text" type="xs:string" use="optional" />
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" name="DemandResetCount">
                  <xs:complexType>
                    <xs:attribute name="Count" type="xs:unsignedByte" use="optional" />
                    <xs:attribute name="TimeStamp" type="xs:string" use="optional" />
                    <xs:attribute name="UOM" type="xs:string" use="optional" />
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" name="Statuses">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element minOccurs="0" maxOccurs="unbounded" name="Status">
                        <xs:complexType>
                          <xs:attribute name="Id" type="xs:unsignedShort" use="optional" />
                          <xs:attribute name="Name" type="xs:string" use="optional" />
                          <xs:attribute name="Category" type="xs:string" use="optional" />
                          <xs:attribute name="Type" type="xs:string" use="optional" />
                          <xs:attribute name="Value" type="xs:string" use="optional" />
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" name="OutageCountSummary">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element minOccurs="0" name="OutageCount">
                        <xs:complexType>
                          <xs:attribute name="ReadingTime" type="xs:string" use="optional" />
                          <xs:attribute name="Value" type="xs:unsignedByte" use="optional" />
                          <xs:attribute name="PreviousReadingTime" type="xs:string" use="optional" />
                          <xs:attribute name="PreviousValue" type="xs:unsignedByte" use="optional" />
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" maxOccurs="unbounded" name="InstrumentationValue">
                  <xs:complexType>
                    <xs:attribute name="Name" type="xs:string" use="optional" />
                    <xs:attribute name="Value" type="xs:decimal" use="optional" />
                    <xs:attribute name="Timestamp" type="xs:string" use="optional" />
                    <xs:attribute name="Phase" type="xs:string" use="optional" />
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" name="ReverseEnergySummary">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element minOccurs="0" name="ReverseEnergy">
                        <xs:complexType>
                          <xs:attribute name="CurrentValue" type="xs:unsignedShort" use="optional" />
                          <xs:attribute name="PreviousValue" type="xs:unsignedShort" use="optional" />
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" name="EventData">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element minOccurs="0" name="EventSpec">
                        <xs:complexType>
                          <xs:attribute name="Type" type="xs:string" use="optional" />
                          <xs:attribute name="Category" type="xs:string" use="optional" />
                        </xs:complexType>
                      </xs:element>
                      <xs:element minOccurs="0" name="Event">
                        <xs:complexType mixed="true">
                          <xs:sequence minOccurs="0">
                            <xs:element minOccurs="0" name="EventAttribute">
                              <xs:complexType>
                                <xs:attribute name="Name" type="xs:string" use="optional" />
                                <xs:attribute name="Value" type="xs:unsignedShort" use="optional" />
                              </xs:complexType>
                            </xs:element>
                          </xs:sequence>
                          <xs:attribute name="DiscoveredAt" type="xs:string" use="optional" />
                          <xs:attribute name="Source" type="xs:string" use="optional" />
                          <xs:attribute name="EventInfo" type="xs:string" use="optional" />
                          <xs:attribute name="TimeStamp" type="xs:string" use="optional" />
                          <xs:attribute name="EndTime" type="xs:string" use="optional" />
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
              </xs:choice>
            </xs:sequence>
            <xs:attribute name="Irn" type="xs:unsignedShort" use="optional" />
            <xs:attribute name="Source" type="xs:string" use="optional" />
            <xs:attribute name="SourceName" type="xs:string" use="optional" />
            <xs:attribute name="SourceIrn" type="xs:unsignedShort" use="optional" />
            <xs:attribute name="Initiator" type="xs:string" use="optional" />
            <xs:attribute name="Purpose" type="xs:string" use="optional" />
            <xs:attribute name="CollectionTime" type="xs:string" use="optional" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="Purpose" type="xs:string" use="optional" />
      <xs:attribute name="version" type="xs:decimal" use="optional" />
      <xs:attribute name="CreationTime" type="xs:string" use="optional" />
    </xs:complexType>
  </xs:element>
</xs:schema>

1 个答案:

答案 0 :(得分:1)

你做不到。 simpleType只能包含文本节点。如果不使用complexType声明,则无法在XSD中声明嵌套元素和属性。