0
votes

I am running into an error where minOccurs="0" in the .xsd is not being respected for one of my elements.

I'll give a simple summary of the schema due security and clarity reasons. The problem has been isolated to "issueAddedOrReinstatedDate" being required but is null in the database.

My problem right now is that adding minOccurs=0 does not fix the requirement issue.


    <xs:complexType name="issueType">
        <xs:sequence>
            <xs:element minOccurs="0" name="issueAddedOrReinstatedDate" type="tns:commonDateType">
                <xs:annotation>
                  <xs:documentation>Appeal: Issue Added/Reinstated Date (Indv Appeal Issues)</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
***
Rest of the relevant code in increasing abstracted levels
***
    <xs:complexType name="listOfIssueTypesType">
        <xs:sequence>
            <xs:element maxOccurs="500" name="issueType" type="tns:issueType">
                <xs:annotation>
                  <xs:documentation>Represents a single issue being appealed</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
----------------------------------------------------
    <xs:complexType name="individualAppealSpecificDetailsType">
        <xs:sequence>

            <xs:element minOccurs="0" name="listOfIssueTypes" type="tns:listOfIssueTypesType">
                <xs:annotation>
                  <xs:documentation>The list of issues being appealed</xs:documentation>
                </xs:annotation>
            </xs:element>

        </xs:sequence>
    </xs:complexType>
-------------------------------
    <xs:complexType name="getAppealResponseType">
        <xs:complexContent>
            <xs:extension base="tns:abstractResponseType">
                <xs:sequence>

                    <xs:element minOccurs="0" name="individualAppealSpecificDetails"
                        type="tns:individualAppealSpecificDetailsType">
                        <xs:annotation>
                          <xs:documentation>A single object representing the distinct set of fields which apply to an Individual Appeal only</xs:documentation>
                        </xs:annotation>    
                    </xs:element>

                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
----------------------------------
    <xs:complexType name="getAppeal">
        <xs:sequence>
            <xs:element minOccurs="0" name="request" type="tns:getAppealRequestType"></xs:element>
        </xs:sequence>
    </xs:complexType>
------------------------------------------
    <xs:complexType name="getAppealRequestType">
        <xs:complexContent>
            <xs:extension base="tns:abstractRequestType">
                <xs:sequence>
                    <xs:element name="appealCaseNumber" type="tns:appealCaseNumberType">
                        <xs:annotation>
                          <xs:documentation>Appeal: Case #</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
-------------------------------
    <xs:complexType name="getAppealResponse">
        <xs:sequence>
            <xs:element minOccurs="0" name="response" type="tns:getAppealResponseType"></xs:element>
        </xs:sequence>
    </xs:complexType>
--------------------------------------
<xs:element name="getAppealResponse" type="tns:getAppealResponse"></xs:element>

Just to add: the original error message is:

cvc-pattern-valid: Value '' is not facet-valid with respect to pattern '\d{2}/\d{2}/\d{4}' for type 'commonDateType'.

Could it be that it the value is not seen as null, but as an empty value?

1

1 Answers

0
votes

MinOccurs=0 means that the element can be omitted, it doesn't mean that it can be present but empty.

Since the error message refers to commonDateType, I don't know why you've chosen to show us part of the schema that doesn't mention that type, but it seems pretty clear that you've got an empty element where the element type doesn't allow it to be empty.