I'm quite new to this, but wanted to share on the forum in case anyone else had encountered a similar issue and got stuck.
I'm querying a Xero API, and it's returning XML, including a wrapper element that I didn't want.
The result looked like this:
<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Id>bd147d0c-c0e7-4421-88e8-8485e2c55072</Id>
<Status>OK</Status>
<ProviderName>Retool</ProviderName>
<DateTimeUTC>2023-02-16T03:05:49.8022877Z</DateTimeUTC>
<BrandingThemes>
<BrandingTheme>
<BrandingThemeID>f1d61428-6c16-46a9-9eb2-3d77b9bdd961</BrandingThemeID>
<Name>Standard</Name>
<Type>INVOICE</Type>
<SortOrder>0</SortOrder>
<CreatedDateUTC>2023-02-14T10:29:10.007</CreatedDateUTC>
</BrandingTheme>
<BrandingTheme>
<BrandingThemeID>dba6749d-d273-43e0-9454-f8110a169fcf</BrandingThemeID>
<Name>Testify</Name>
<Type>INVOICE</Type>
<SortOrder>1</SortOrder>
<CreatedDateUTC>2023-02-15T05:45:56.063</CreatedDateUTC>
</BrandingTheme>
</BrandingThemes>
</Response>
The solve was to import an XML Parsing library (you can add globally, but I loaded into the App specifically by clicking the Three Dots in the top right and choosing "Scripts and Styles")
The path to use was
https://cdnjs.cloudflare.com/ajax/libs/fast-xml-parser/4.1.1/fxparser.min.js
The transformer for my query is set to:
const parser = new XMLParser();
return parser.parse(data).Response
The result now shows correctly in the array format, as
Hope that's useful!
DJ