XQuery Updates giving an error

Hi,
I am trying to create an update xquery to change a record with a certain id, but it keeps giving me an error. I’ve search on the net, but I can’t find what it means. I think its something to do with the schema

The query is


{-- Enter a PEA ID below--}
update let $peaID := '1217'
{-- RUN QUERY --}
do replace input()/pea[id = $peaID][currentStatus/status = 'raised']/currentStatus/status/text() with 'inPreperation'

Which is giving me the following error


(cvc-enumeration-valid) A value not defined in the respective enumeration has been found during validation; datatype validation for element 'status' of type xs:string failed

The schema is just a simple type like so:

      <xs:complexType mixed="false" name="peaCurrentStatusType">
         <xs:sequence maxOccurs="1" minOccurs="1">
[b]            <xs:element maxOccurs="1" minOccurs="1" name="status" type="peaStatusType"/>[/b]
            <xs:element maxOccurs="1" minOccurs="1" name="lastChangeDate" type="xs:dateTime"/>
         </xs:sequence>
      </xs:complexType>
      <xs:simpleType name="peaStatusType">
         <xs:restriction base="xs:string">
            <xs:enumeration value="inPreparation"/>
            <xs:enumeration value="raised"/>
            <xs:enumeration value="approved"/>
            <xs:enumeration value="completed"/>
            <xs:enumeration value="denied"/>
            <xs:enumeration value="canceled"/>
            <xs:enumeration value="withdrawn"/>
            <xs:enumeration value="deniedWithConditions"/>
         </xs:restriction>
      </xs:simpleType>

Any Ideas why this isn’t working would be very much appreciated :smiley:

Hi Ryan,
I think you have met your typo
inPreparation or inPreperation ?

Finn

Thanks, can’t believe I didn’t spot that