Open Hanmac opened 2 years ago
i got this xsd part:
<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 is now that the sequence has maxOccurs="unbounded", so my first try was to put the sequence into its own class, and try to make it inline
maxOccurs="unbounded"
/** * @Serializer\XmlRoot("EMAILS") */ class Emails { /** * @Serializer\Expose * @Serializer\XmlList(inline = "true") * @Serializer\Inline * * @var EmailsInner[] */ protected array $inners = []; }
<?xml version="1.0" encoding="UTF-8"?> <EMAILS> <EMAIL><![CDATA[A]]></EMAIL> <EMAIL><![CDATA[B]]></EMAIL> </EMAILS>
<?xml version="1.0" encoding="UTF-8"?> <EMAILS> <entry> <EMAIL><![CDATA[A]]></EMAIL> </entry> <entry> <EMAIL><![CDATA[B]]></EMAIL> </entry> </EMAILS>
i assume it isn't just serializing but de-serializing too which should be affected by this?
and no i can't change the schema.
With PreSerialize i could add it to a list attribute to serialize it, but that causes it to be this:
<?xml version="1.0" encoding="UTF-8"?> <EMAILS> <entry><![CDATA[A]]></entry> <entry><![CDATA[KeyA]]></entry> <entry><![CDATA[B]]></entry> <entry><![CDATA[KeyB]]></entry> </EMAILS>
instead of this:
<?xml version="1.0" encoding="UTF-8"?> <EMAILS> <EMAIL><![CDATA[A]]></EMAIL> <PUBLIC_KEY><![CDATA[KeyA]]></PUBLIC_KEY> <EMAIL><![CDATA[B]]></EMAIL> <PUBLIC_KEY><![CDATA[KeyB]]></PUBLIC_KEY> </EMAILS>
Steps required to reproduce the problem
i got this xsd part:
my Problem is now that the sequence has
maxOccurs="unbounded"
, so my first try was to put the sequence into its own class, and try to make it inlineExpected Result
Actual Result
i assume it isn't just serializing but de-serializing too which should be affected by this?
and no i can't change the schema.
With PreSerialize
With PreSerialize i could add it to a list attribute to serialize it, but that causes it to be this:
Actual Result
instead of this:
Expected Result