Skip to content

How do I add CDATA within an XML document at the given path

This example demonstrates adding CDATA within an XML document at the given path.

In the solution shown below, you see a path is provided which will be converted to CDATA i.e., everything between the "age" tag is treated as character data and not as markup.

Solution:

# Command Target Value
Add CDATA within an XML document at the given path
1 xmlAddCDATA <insurance><age>45</age><income>20000</income><zipcode>08817</zipcode><result>You are eligible for a subsidy.</result></insurance> || /insurance/age CDATA_XML

Tips, Tricks, Gotchas & Best Practices:  

  • The term CDATA means, Character Data. CDATA is defined as blocks of text that are not parsed by the parser, but are otherwise recognized as markup
  • By using CDATA section, you are commanding the parser that the particular section of the document contains no markup and should be treated as regular text


Feedback and Knowledge Base