goetas-webservices / xsd2php

Convert XSD into PHP classes and JMS serializer definitions
MIT License
234 stars 88 forks source link

Handling of xsd:squence with maxOccurs="unbounded" #149

Open Hanmac opened 1 year ago

Hanmac commented 1 year ago

Having this part of xsd:

<xsd:element name="EMAILS">
    <xsd:complexType>
        <xsd:sequence maxOccurs="unbounded">
            <xsd:element ref="EMAIL"/>
            <xsd:element ref="PUBLIC_KEY" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>  

my problem currently is about <xsd:sequence maxOccurs="unbounded">

because of this, wouldn't that make this valid?

<EMAILS>
  <EMAIL>A</EMAIL>
  <PUBLIC_KEY>K1A</PUBLIC_KEY>
  <EMAIL>B</EMAIL>
  <PUBLIC_KEY>K1B</PUBLIC_KEY>
</EMAILS>

and wouldn't that cause problems when serializing, and de-serializing? because currently, it would be serialized as this which isn't valid:

<EMAILS>
  <EMAIL>A</EMAIL>
  <EMAIL>B</EMAIL>
  <PUBLIC_KEY>K1A</PUBLIC_KEY>
  <PUBLIC_KEY>K1B</PUBLIC_KEY>
</EMAILS>