10-17-2023 11:58 AM
Hello, I'm trying to send some XML to a REST endpoint, but it looks like the XML Generator is removing any element that is empty. For example:
<?xml version="1.0" encoding="UTF-8"?>
<rootTest>
<foo>bar</foo>
<innerTest></innerTest>
<secondTest />
</rootTest>
Using the code above, the output is missing the innerTest element and the secondTest element. This is causing a problem in the REST call since it's expecting that value even though it's empty. Is there a way to tell the snap to include empty elements?
Solved! Go to Solution.
11-02-2023 06:16 PM
Wanted to follow up with this since we found a workaround (a support ticket helped). Instead of an empty tag, you can put a token in XML and then do a replaceAll/replace function in a mapper directly after the XML to set the token to an empty string:
$foo.replaceAll("[TOKEN]", "")
This worked. Not as clean as we would like, but it solves the problem.
11-02-2023 06:16 PM
Wanted to follow up with this since we found a workaround (a support ticket helped). Instead of an empty tag, you can put a token in XML and then do a replaceAll/replace function in a mapper directly after the XML to set the token to an empty string:
$foo.replaceAll("[TOKEN]", "")
This worked. Not as clean as we would like, but it solves the problem.