0 Replies Latest reply on Dec 10, 2019 9:14 PM by Venkat Neppali

    Xml genaration issue using mapper - Minlength and Maxlength defined for element at XSD.

    Venkat Neppali Active Member

      Hi All,

       

      I am facing issue while generating xml. Please find below details for same.

       

      One of my element type as defined as below.

       

      Target XSD deatails:

       

      --------------------------------------------------------------------------------

                  <xs:element name="UnqTradIdr" type="Identifier52Text">

                      <xs:annotation>

                          <xs:documentation source="Name" xml:lang="EN">UniqueTradeIdentifier</xs:documentation>

                          <xs:documentation source="Definition" xml:lang="EN">Unique Trade Identifier (UTI) as agreed with the other counterparty.</xs:documentation>

                      </xs:annotation>

                  </xs:element>

      ----------------------------------------------------------------------------------

          <xs:simpleType name="Identifier52Text">

              <xs:annotation>

                  <xs:documentation source="Name" xml:lang="EN">Identifier52Text</xs:documentation>

                  <xs:documentation source="Definition" xml:lang="EN">Specifies a character string with a maximum length of 52 characters, only upper-case alphabetic characters A–Z and the digits 0–9, inclusive in both cases, are allowed.</xs:documentation>

              </xs:annotation>

              <xs:restriction base="xs:string">

                  <xs:pattern value="[A-Z0-9]"/>

                  <xs:minLength value="1"/>

                  <xs:maxLength value="52"/>

              </xs:restriction>

          </xs:simpleType>

       

       

      Source XSD Details:

       

         <xs:element minOccurs="0" name="UTIID" type="xs:string"/>

       

      -------------------------------------------------------------------------------------------

      I have created mapper to read xml and genarate xml. However, Facing issue if at all length is more than 1 character. Its working fine if length is 1 character.

       

      error: [R303380] Map: Failed to cast value from source type to Destination type

       

      Can someone help me to understand the issue.

       

      Thanks,

      Venkat Neppali.