I'm currently working on a requirement where i have to store xml data in baas and since baas takes only json data we are trying to encode the xml and store it and decode in the GET call and sending the xml response back to client.
The issue im having here is related to CDATA in the xml payload.
When i try to encode the xml data i have to convert the XML object to string and for that i'm using https://estk.aenhancers.com/9%20-%20Integrating%20XML%20into%20JavaScript/the-xml-object.html which provides me methods to parse the XML and also convert the XML object to string.Now when i convert it to string i can see the CDATA as part of my trace session and then im encoding it but the momment i run decode function right, I cannot see the CDATA as part of my xml rather im seeing plain text.
other ways i've tried
toString(),encodeURIComponent(),decodeURIComponent()-->all these functions also had the same result
Is there any way I can retain the CDATA elemnt even after converting to string and encoding it.
Any hint on how we can do this is really helpful!!