Hello Apigeeks,
1. How do I update value in XML that comes from request payload?
2. How do I insert new element to the XML that comes from request payload?
For both items mentioned above, I tried with Javascript object model
var name = context.targetRequest.body.asXML.name; request.content.asXML context.proxyRequest.content.asXML
Unfortunately, these does not help me to do what I want. Basically,
1. I want to modify a value in XML, say <amount>0</amount>
update to <amount>200</amount>
2. I want to add new element to the XML, say <student><name>Thomson</name></student>
to <student><id>xx123</id><name>Thomson</name></student>
Not sure if it's matter, but it is a SOAP XML.
Solved! Go to Solution.
Patricia,
It does not work for update (that does not involves adding new namespace)
What do you mean? It works for me, with the example payload you provided.
The JS error happens because your JavaScript tool does not recognize the e4x extensions. There's no error in the JS that I gave you.
Attached please find a working example.