Sometimes got "Source is not valid XML" when parsing XML

I have a scenario that will ask chatGPT to export an XML, then I use parse XML to catch it. It works most of the time, but get “Source is not valid XML” error sometimes. The xml structures are the same, would like to know what’s the problem and how to fix it. Thanks.

INPUT with no error

INPUT with error

Adding a prompt to GPT that strictly focuses on creating a valid XML and increasing the tokens will solve the problem to a great extent.

Thanks for your reply.
The GPT module already tuned and generating the XML with the same structure, just don’t know why the XML Parse module sometimes catch some error.

you can see from the XML parse INPUTs are having an identical structure, but one got “source is not valid XML” and I don’t know why.

Welcome to the Make community!

The XML may have special characters that may cause it to be invalid.

Perhaps get it to output JSON then convert it to XML.

samliewrequest private consultation

Join the unofficial Make Discord server to chat with us!

1 Like