0

Disclaimer: This is only my second time using XML and am a complete novice. Apologies in advance for the text dump.

I have been tasked with leveraging an XML schema to export and upload data from XLS tables. The governing group provided a format guide for each line and the precise verbiage to use.

The root element is IDDEEvent and there exist no required child elements, so how the line items may be filled and the remaining can remain blank.

Some of the ComplexType elements have a child element within a sequence. In some cases enumeration is used, though they're tied to a number that is given an explanation through xs:documentation element.

In one case there is a ComplexType element that contains multiple child elements that are part of an xs:choice element (not entirely sure how that works)

When I go to Excel --> Developer --> Source and upload and map out the schema and populate with basic info, I get an error that states the XML data cannot be saved or exported due to the maps.

The mapping seems to work just fine, though I noticed that the only Element listed without a type is the one titled MS4Discharge which may be just how it's called.

I've gone through the documentation on the support page, but nothing stands out to me. The data I used as a test to export has historically been accepted as the correct format. I even tried uploading with the minimal amount of details and the error still pops up.

Really stumped with this one. Again, completely new to this and unsure of what I'm doing, so any and all help would be appreciated on how to proceed so I can use this schema to start exporting date.

Thanks in advance!

<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>```

2 Answers2

0

while I can't tell much about Excel import/export (I don't get that part with the map – maybe because of different version or localization), I can help you with the XML schema part.

You wrote you're not sure how choice, sequence and all work. To make it easier to get the basic idea, I leave out some details: All three define for a parent element how the child elements may appear in an XML document. choice means at maximum one of the named child elements can be present, while sequence & all require that all child elements appear – in exactly the same order as in the XML schema (sequence) or in any order (all). Of course, if minOccurs for a child element is 0, this child may also be absent. You'll find more on that at https://www.w3.org/TR/xmlschema-1/#Model_Group_details which is just as detailed as formal

In contrast to sequence & all, enumerations are not about child elements (which could contain a huge XML-sub-tree) but the actual values, i.e. the leafs of the tree. You can think of them as additional restrictions of the value data type; in your XSD, TraceType is not only restricted to strings but even further restricted to only the listed strings "0", "1",..,"6".

MS4Discharge has a type (IIRC elsewise the schema was invalid). It is a self-defined one called Discharge, defined some 50 lines further down the schema containing e.g. child element YesNotifiedECY.

Hope that makes some things more tangible for you Georg

Georg
  • 71
0

I had this problem one of the field that is mapped is a required field it need some information and my be empty When i removed that field it let me export it

Barry
  • 1