Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

SimpleXMLEncoder and ArrayCollection Conversion

Avatar

Former Community Member
I am using the SimpleXMLEncoder class to covert objects to
XML. All is well except when dealing with typed Array Collections.



If I have an array of objects who themselves have their own
types, the XML that the encoder generates refers to them as items,
not the type of the object within the array. Here is an example.

Here is what I want….



<campuses>

<campuse_choice>

properties here……

</campuse_choice>

</campuses>



What i get is…..



<campuses>

<list>

<source>

<item>

properties here.....

</item>

</source>

</list>

</campuses>



I looked in the SimpleXMLEncoder class and I see the line
(152) that converts them to items. any way to have it pick up the
object types within the ArrayCollection?
0 Replies