How do I append values to the end of the indicated NodeList within an XML document
This example demonstrates on how to append values at the end of the indicated NodeList within an XML document and returns the result.
In the solution shown below, a new node is appended to the existing XML String using "xmlAppendToNodeList" command at the specified path. If the XML path and the syntax of the new node is valid then the node will be appended to the XML. The command fails if the path does not exist with an error message "XML_PATH_DOES_NOT_EXIST".
Solution:
# | Command | Target | Value |
---|---|---|---|
Append values to the end of the NodeList within an XML | |||
1 | xmlAppendToNodeList | <insurance><age>45</age><income>20000</income><zipcode>08817</zipcode><result>You are eligible for a subsidy.</result></insurance> || {/insurance, <family size>45</family size>} | XML_result |
Tips, Tricks, Gotchas & Best Practices:
- The XML should be valid and encoded in "UTF-8" format.
- As a best practice, it is always advisable to define the variable names without any spaces and if you want to differentiate the words, use underscores.