这是我正在使用的XSD(直接从源代码下载)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.newyorkfed.org/resources/sdmxml/schemas/V2_1/fundRate" xmlns:dsd="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/data/structurespecific" xmlns:common="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common" xmlns:codes="http://www.newyorkfed.org/resources/sdmxml/schemas/V2_1/fundRateCommon" targetNamespace="http://www.newyorkfed.org/resources/sdmxml/schemas/V2_1/fundRate" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/data/structurespecific" schemaLocation="SDMXDataStructureSpecific.xsd"/>
<xs:import namespace="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common" schemaLocation="SDMXCommon.xsd"/>
<xs:import namespace="http://www.newyorkfed.org/resources/sdmxml/schemas/V2_1/fundRateCommon" schemaLocation="fundRateCommon.xsd"/>
<xs:complexType name="RateDataSetType">
<xs:complexContent>
<xs:restriction base="dsd:TimeSeriesDataSetType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
<xs:element name="DataProvider" type="common:DataProviderReferenceType" form="unqualified" minOccurs="0"/>
<xs:element name="Group" type="GroupType" form="unqualified" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice minOccurs="0">
<xs:element name="Series" type="RateSeriesType" form="unqualified" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="REPORTING_YEAR_START_DAY" type="xs:gMonthDay" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="SupplementalDataSetType">
<xs:complexContent>
<xs:restriction base="dsd:TimeSeriesDataSetType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
<xs:element name="DataProvider" type="common:DataProviderReferenceType" form="unqualified" minOccurs="0"/>
<xs:element name="Group" type="GroupType" form="unqualified" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice minOccurs="0">
<xs:element name="Series" type="SupplementalSeriesType" form="unqualified" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="REPORTING_YEAR_START_DAY" type="xs:gMonthDay" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="GroupType" abstract="true">
<xs:complexContent>
<xs:restriction base="dsd:GroupType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="type" type="GroupType.ID" use="optional"/>
<xs:anyAttribute namespace="##local"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:simpleType name="GroupType.ID">
<xs:restriction base="common:IDType">
<xs:enumeration value="RateSiblingGroup"/>
<xs:enumeration value="SupplementalSiblingGroup"/>
<xs:enumeration value="RateGroup"/>
<xs:enumeration value="SupplementalGroup"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="RateSiblingGroup">
<xs:complexContent>
<xs:restriction base="GroupType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="DECIMALS" type="codes:SDMX.CL_DECIMALS.1.0" use="optional"/>
<xs:attribute name="FUNDRATE_OBS_POINT" type="codes:FRBNY.CL_FUNDRATE_OBS_POINT.1.0" use="required"/>
<xs:attribute name="FUNDRATE_TYPE" type="codes:FRBNY.CL_FUNDRATE_TYPE.1.0" use="required"/>
<xs:attribute name="TITLE" type="xs:string" use="optional"/>
<xs:attribute name="type" type="GroupType.ID" use="optional" fixed="RateSiblingGroup"/>
<xs:attribute name="UNIT_MEASURE" type="codes:SDMX.CL_UNIT_MEASURE.1.0" use="optional"/>
<xs:attribute name="UNIT_MULT" type="codes:SDMX.CL_UNIT_MULT.1.0" use="optional"/>
<xs:attribute name="LAST_DAY_OF_MAINTENANCE_PERIOD" type="xs:boolean" use="optional"/>
<xs:attribute name="REPORTING_YEAR_START_DAY" type="xs:gMonthDay" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="SupplementalSiblingGroup">
<xs:complexContent>
<xs:restriction base="GroupType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="DECIMALS" type="codes:SDMX.CL_DECIMALS.1.0" use="optional"/>
<xs:attribute name="FUNDRATE_SUPPLEMENTAL" type="codes:FRBNY.CL_FUNDRATE_SUPPLEMENTAL.1.0" use="required"/>
<xs:attribute name="FUNDRATE_TYPE" type="codes:FRBNY.CL_FUNDRATE_TYPE.1.0" use="required"/>
<xs:attribute name="TITLE" type="xs:string" use="optional"/>
<xs:attribute name="type" type="GroupType.ID" use="optional" fixed="SupplementalSiblingGroup"/>
<xs:attribute name="UNIT_MEASURE" type="codes:SDMX.CL_UNIT_MEASURE.1.0" use="optional"/>
<xs:attribute name="UNIT_MULT" type="codes:SDMX.CL_UNIT_MULT.1.0" use="optional"/>
<xs:attribute name="REPORTING_YEAR_START_DAY" type="xs:gMonthDay" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="RateGroup">
<xs:complexContent>
<xs:restriction base="GroupType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="COLL_METHOD" type="xs:string" use="optional"/>
<xs:attribute name="FUNDRATE_TYPE" type="codes:FRBNY.CL_FUNDRATE_TYPE.1.0" use="required"/>
<xs:attribute name="type" type="GroupType.ID" use="optional" fixed="RateGroup"/>
<xs:attribute name="REPORTING_YEAR_START_DAY" type="xs:gMonthDay" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="SupplementalGroup">
<xs:complexContent>
<xs:restriction base="GroupType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="COLL_METHOD" type="xs:string" use="optional"/>
<xs:attribute name="FUNDRATE_TYPE" type="codes:FRBNY.CL_FUNDRATE_TYPE.1.0" use="required"/>
<xs:attribute name="type" type="GroupType.ID" use="optional" fixed="SupplementalGroup"/>
<xs:attribute name="REPORTING_YEAR_START_DAY" type="xs:gMonthDay" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="RateSeriesType">
<xs:complexContent>
<xs:restriction base="dsd:TimeSeriesType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
<xs:element name="Obs" type="ObsType" form="unqualified" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="FREQ" type="codes:SDMX.CL_FREQ.1.0" use="required"/>
<xs:attribute name="FUNDRATE_OBS_POINT" type="codes:FRBNY.CL_FUNDRATE_OBS_POINT.1.0" use="required"/>
<xs:attribute name="FUNDRATE_TYPE" type="codes:FRBNY.CL_FUNDRATE_TYPE.1.0" use="required"/>
<xs:attribute name="REPORTING_YEAR_START_DAY" type="xs:gMonthDay" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="SupplementalSeriesType">
<xs:complexContent>
<xs:restriction base="dsd:TimeSeriesType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
<xs:element name="Obs" type="ObsType" form="unqualified" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="FREQ" type="codes:SDMX.CL_FREQ.1.0" use="required"/>
<xs:attribute name="FUNDRATE_SUPPLEMENTAL" type="codes:FRBNY.CL_FUNDRATE_SUPPLEMENTAL.1.0" use="required"/>
<xs:attribute name="FUNDRATE_TYPE" type="codes:FRBNY.CL_FUNDRATE_TYPE.1.0" use="required"/>
<xs:attribute name="REPORTING_YEAR_START_DAY" type="xs:gMonthDay" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ObsType">
<xs:complexContent>
<xs:restriction base="dsd:TimeSeriesObsType">
<xs:sequence>
<xs:element ref="common:Annotations" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="CONF_STATUS_OBS" type="codes:SDMX.CL_CONF_STATUS_OBS.1.0" use="optional"/>
<xs:attribute name="OBS_STATUS" type="codes:SDMX.CL_OBS_STATUS.1.0" use="optional"/>
<xs:attribute name="OBS_VALUE" type="xs:decimal" use="required"/>
<xs:attribute name="TIME_PERIOD" type="xs:date" use="required"/>
<xs:attribute name="LAST_DAY_OF_MAINTENANCE_PERIOD" type="xs:boolean" use="optional"/>
<xs:attribute name="REPORTING_YEAR_START_DAY" type="xs:gMonthDay" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
&#13;
当我运行XSD代码时,我收到此错误:
我尝试在基础级别添加复杂类型元素,这些元素使用名称和类型属性定义每个元素,但这似乎不起作用。
答案 0 :(得分:0)
我认为问题在于您缺少一些必要的XSD文档。在您在评论中链接到的网页https://www.newyorkfed.org/markets/effr-obfr,可以获得两个XSD文件:fundRateCommon.xsd
和fundRate.xsd
。
但在fundRate.xsd
中,有几个import
语句:
<xs:import namespace="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/data/structurespecific" schemaLocation="SDMXDataStructureSpecific.xsd"/>
<xs:import namespace="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common" schemaLocation="SDMXCommon.xsd"/>
<xs:import namespace="http://www.newyorkfed.org/resources/sdmxml/schemas/V2_1/fundRateCommon" schemaLocation="fundRateCommon.xsd"/>
并且在此页面中,您无法下载SDMXCommon.xsd
和SDMXDataStructureSpecific.xsd
。您从XSD2Code获得的错误似乎与SDMXDataStructureSpecific.xsd
的内容有关。
同样下载这些XSD文件,然后重试。
答案 1 :(得分:0)
好像你错过了基础SDMX .xsd的..这些都可以从 标准选项卡下的sdmx.org ......