免责声明:这只是我第二次使用 XML,而且完全是个新手。提前为文本转储道歉。
我的任务是利用 XML 架构从 XLS 表导出和上传数据。管理小组为每一行提供了格式指南以及要使用的精确措辞。
根元素是 IDDEEvent,并且不存在必需的子元素,因此可以填充行项目,而其余部分可以保持空白。
一些 ComplexType 元素在序列中有一个子元素。在某些情况下使用枚举,但它们与通过 xs:documentation 元素给出解释的数字相关联。
在一种情况下,有一个 ComplexType 元素包含多个子元素,这些子元素是 xs:choice 元素的一部分(不完全确定它是如何工作的)
当我转到 Excel --> 开发人员 --> 源并上传和映射架构并填充基本信息时,我收到一条错误消息,指出由于映射,无法保存或导出 XML 数据。
映射似乎工作得很好,但我注意到唯一没有列出的元素类型标题是MS4放电也许这就是它的名字。
我查看了支持页面上的文档,但没有什么特别之处。我用来测试导出的数据历来被认为是正确的格式。我甚至尝试上传最少的详细信息,但错误仍然弹出。
真的被这个问题难住了。再说一遍,我对此完全陌生,不确定自己在做什么,所以如果大家能帮我继续操作,我将不胜感激,这样我就可以使用此架构开始导出日期。
提前致谢!
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="IDDEEvents">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="IDDEEvent" type="IDDEEvent" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="IDDEEvent">
<xs:annotation>
<xs:documentation>One particular IDDE event</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element maxOccurs="1" minOccurs="0" name="Jurisdiction">
<xs:annotation>
<xs:documentation>Permit Number</xs:documentation>
<xs:documentation>If omitted, all IDDEs will be imported to a permit selected through the UI</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="9"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="IncidentId">
<xs:annotation>
<xs:documentation>Incident ID</xs:documentation>
<xs:documentation>If omitted, WQWebIDDE can't identify IDDEs to update and will simply insert all IDDEs as fresh records</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="DateReported" type="SqlDate">
<xs:annotation>
<xs:documentation>Date incident reported</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="DateResponseBegin" type="SqlDate">
<xs:annotation>
<xs:documentation>Date incident response began</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="DateResponseEnd" type="SqlDate">
<xs:annotation>
<xs:documentation>Date incident response ended</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="Discovereds" type="Discovered">
<xs:annotation>
<xs:documentation>How was the incident discovered?</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="MS4Discharge" type="Discharge">
<xs:annotation>
<xs:documentation>Did the incident discharge to the MS4?</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="Location" type="Location">
<xs:annotation>
<xs:documentation>Location of the incident</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="Pollutants" type="Pollutant">
<xs:annotation>
<xs:documentation>Pollutants identified</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="Sources" type="Source">
<xs:annotation>
<xs:documentation>Source or cause</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="Traces" type="Trace">
<xs:annotation>
<xs:documentation>Source Tracing</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="Corrections" type="Correction">
<xs:annotation>
<xs:documentation>Correction or elimination methods</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="Notes" type="xs:string">
<xs:annotation>
<xs:documentation>Field notes, explanations, and/or other comments</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
<xs:simpleType name="SqlDate">
<xs:annotation>
<xs:documentation>xs:date limited to SQL Server's operating range</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:date">
<xs:minInclusive value="1753-01-01" />
<xs:maxInclusive value="9999-12-31" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Discharge">
<xs:choice>
<xs:element name="YesNotifiedECY" type="YesNotifiedECYDischarge"/>
<xs:element name="YesNotifiedDOH" type="YesNotifiedDOHDischarge"/>
<xs:element name="YesNoNotice" type="YesNoNoticeDischarge"/>
<xs:element name="YesAllowable" type="YesAllowableDischarge"/>
<xs:element name="NoNoneFound" type="NoNoneFoundDischarge"/>
<xs:element name="NoCleanedUp" type="NoCleanedUpDischarge"/>
<xs:element name="NoToUIC" type="NoToUICDischarge"/>
<xs:element name="Unknown" type="UnknownDischarge"/>
<xs:element name="Other" type="OtherDischarge"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="Discovered">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Discovered">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="Explain" type="xs:string"/>
</xs:sequence>
<xs:attribute name="type" type="DiscoveredType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Location">
<xs:all>
<xs:element maxOccurs="1" minOccurs="0" name="Address" type="AddressType" />
<xs:element maxOccurs="1" minOccurs="0" name="LatLong" type="LatLongType" />
</xs:all>
</xs:complexType>
<xs:complexType name="Pollutant">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Pollutant">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="Explain" type="xs:string"/>
</xs:sequence>
<xs:attribute name="type" type="PollutantType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Source">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Source">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="Explain" type="xs:string"/>
</xs:sequence>
<xs:attribute name="type" type="SourceType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Trace">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Trace">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="Explain" type="xs:string"/>
</xs:sequence>
<xs:attribute name="type" type="TraceType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Correction">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Correction">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="Explain" type="xs:string"/>
</xs:sequence>
<xs:attribute name="type" type="CorrectionType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="YesNotifiedECYDischarge">
<xs:annotation>
<xs:documentation>Discharge reached MS4, Notified Ecology</xs:documentation>
</xs:annotation>
</xs:complexType>
<xs:complexType name="YesNotifiedDOHDischarge">
<xs:annotation>
<xs:documentation>Discharge reached MS4, Notified Ecology and Health</xs:documentation>
</xs:annotation>
</xs:complexType>
<xs:complexType name="YesNoNoticeDischarge">
<xs:annotation>
<xs:documentation>Discharge reached MS4, Did not notify Ecology</xs:documentation>
</xs:annotation>
</xs:complexType>
<xs:complexType name="YesAllowableDischarge">
<xs:annotation>
<xs:documentation>Discharge reached MS4, but it was allowable</xs:documentation>
</xs:annotation>
</xs:complexType>
<xs:complexType name="NoNoneFoundDischarge">
<xs:annotation>
<xs:documentation>No discharge found</xs:documentation>
</xs:annotation>
</xs:complexType>
<xs:complexType name="NoCleanedUpDischarge">
<xs:annotation>
<xs:documentation>Discharge cleaned up and did not reach MS4</xs:documentation>
</xs:annotation>
</xs:complexType>
<xs:complexType name="NoToUICDischarge">
<xs:annotation>
<xs:documentation>Discharge to Underground Injection Control (UIC) well</xs:documentation>
</xs:annotation>
</xs:complexType>
<xs:complexType name="UnknownDischarge">
<xs:annotation>
<xs:documentation>Unknown if discharge reached MS4</xs:documentation>
</xs:annotation>
</xs:complexType>
<xs:complexType name="OtherDischarge">
<xs:annotation>
<xs:documentation>Something else happened, tell us what</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="Explain" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="DiscoveredType">
<xs:annotation>
<xs:documentation>Responses for How was this incident discovered or reported to you?</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="0">
<xs:annotation>
<xs:documentation>Pollution hotline (phone, web, app)</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="1">
<xs:annotation>
<xs:documentation>Direct report to your staff</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="2">
<xs:annotation>
<xs:documentation>Staff referral</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="3">
<xs:annotation>
<xs:documentation>Other agency referral</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="4">
<xs:annotation>
<xs:documentation>ERTS referral</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="5">
<xs:annotation>
<xs:documentation>Business inspection</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="6">
<xs:annotation>
<xs:documentation>Construction inspection</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="7">
<xs:annotation>
<xs:documentation>MS4 inspection or screening</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="8">
<xs:annotation>
<xs:documentation>Other</xs:documentation>
<xs:appinfo>Explain</xs:appinfo>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AddressType">
<xs:annotation>
<xs:documentation>Conventional Street Address or Nearest Intersection</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Address" type="xs:string" />
<xs:element name="City" type="xs:string" />
<xs:element maxOccurs="1" minOccurs="0" name="PostalCode" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="LatLongType">
<xs:annotation>
<xs:documentation>Latitude Longitude pair, 6 decimal digits.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Latitude" type="LatNumber" />
<xs:element name="Longitude" type="LongNumber" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name="LatNumber">
<xs:annotation>
<xs:documentation>Latitude, 6 decimal digits.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="8" />
<xs:fractionDigits value="6" />
<xs:minInclusive value="-90" />
<xs:maxInclusive value="90" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LongNumber">
<xs:annotation>
<xs:documentation>Longitude, 6 decimal digits.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="9" />
<xs:fractionDigits value="6" />
<xs:minInclusive value="-180" />
<xs:maxInclusive value="180" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PollutantType">
<xs:restriction base="xs:string">
<xs:enumeration value="0">
<xs:annotation>
<xs:documentation>Unconfirmed, unspecified, or not identified</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="1">
<xs:annotation>
<xs:documentation>Fuel and/or vehicle related fluids</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="2">
<xs:annotation>
<xs:documentation>Food-related oil/grease</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="3">
<xs:annotation>
<xs:documentation>Sediment/soil</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="4">
<xs:annotation>
<xs:documentation>Solid waste/trash</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="5">
<xs:annotation>
<xs:documentation>Sewage/septage/pet waste/human waste</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="6">
<xs:annotation>
<xs:documentation>Other wastewater</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="7">
<xs:annotation>
<xs:documentation>Paint</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="8">
<xs:annotation>
<xs:documentation>Firefighting foam</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="9">
<xs:annotation>
<xs:documentation>Soap or cleaning chemicals</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="10">
<xs:annotation>
<xs:documentation>Other</xs:documentation>
<xs:appinfo>Explain</xs:appinfo>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SourceType">
<xs:restriction base="xs:string">
<xs:enumeration value="0">
<xs:annotation>
<xs:documentation>Unconfirmed, unspecified, or not identified</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="1">
<xs:annotation>
<xs:documentation>Vehicle-related business</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="2">
<xs:annotation>
<xs:documentation>Food-related business</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="3">
<xs:annotation>
<xs:documentation>Landscape-related business</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="4">
<xs:annotation>
<xs:documentation>Mobile business</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="5">
<xs:annotation>
<xs:documentation>Construction activity</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="6">
<xs:annotation>
<xs:documentation>Other commercial/industrial activity</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="7">
<xs:annotation>
<xs:documentation>Vehicle collision</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="8">
<xs:annotation>
<xs:documentation>Other accident/spill</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="9">
<xs:annotation>
<xs:documentation>Intentional dumping</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="10">
<xs:annotation>
<xs:documentation>Illicit connection</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="11">
<xs:annotation>
<xs:documentation>Other</xs:documentation>
<xs:appinfo>Explain</xs:appinfo>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TraceType">
<xs:restriction base="xs:string">
<xs:enumeration value="0">
<xs:annotation>
<xs:documentation>Not applicable</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="1">
<xs:annotation>
<xs:documentation>Observation (color/sheen/turbidity/floatables/odor)</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="2">
<xs:annotation>
<xs:documentation>Map analysis</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="3">
<xs:annotation>
<xs:documentation>Dye, smoke, or pressure testing</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="4">
<xs:annotation>
<xs:documentation>Field indicator measurements</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="5">
<xs:annotation>
<xs:documentation>Analytical laboratory indicators</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="6">
<xs:annotation>
<xs:documentation>Other</xs:documentation>
<xs:appinfo>Explain</xs:appinfo>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="CorrectionType">
<xs:restriction base="xs:string">
<xs:enumeration value="0">
<xs:annotation>
<xs:documentation>Clean-up</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="1">
<xs:annotation>
<xs:documentation>Education/technical assistance</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="2">
<xs:annotation>
<xs:documentation>Add or modify operational source control BMP</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="3">
<xs:annotation>
<xs:documentation>Add or modify structural source control BMP</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="4">
<xs:annotation>
<xs:documentation>Add or modify treatment BMP</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="5">
<xs:annotation>
<xs:documentation>Enforcement</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="6">
<xs:annotation>
<xs:documentation>Referred to other agency or department</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="7">
<xs:annotation>
<xs:documentation>Other</xs:documentation>
<xs:appinfo>Explain</xs:appinfo>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:schema>```
答案1
虽然我无法讲太多有关 Excel 导入/导出的知识(我不明白地图上的那部分 - 可能是因为版本或本地化不同),但我可以帮助您处理 XML 模式部分。
你写道你不确定如何选择,顺序和全部工作。为了便于理解基本思想,我省略了一些细节:所有这三个元素都定义了父元素如何显示子元素在 XML 文档中。选择意味着最多只能有一个命名的子元素,而顺序&全部要求所有子元素的出现顺序与 XML 架构中的顺序完全相同(顺序) 或以任何顺序 (全部)。当然,如果子元素的 minOccurs 为 0,则该子元素也可能不存在。您可以在以下位置找到更多信息:https://www.w3.org/TR/xmlschema-1/#Model_Group_details就像正式的
答案2
我遇到了这个问题,映射的字段之一是必填字段,它需要一些信息,但它是空的,当我删除该字段时,它允许我将其导出