I have an xml file where I have a json String that is embedded in a xml element, like
So what I'm currently doing is creating a ElementBindingImpl that will grab the XmlElement and read the contents of the CDATA section. Reading works fine, but the problem I'm having is when there is not a <metadata> element and I have to create one and then add a CDATA section. Is it possible to create a CDATA child node for a XmlElement
To bind to CDATA, you will need to implement XmlValueBindingImpl and use @CustomXmlValueBinding to attach it to the property. Take a look at the XmlValueBindingImpl API. The methods that you need to implement are read() and write(). Use xml() method to get a handle on XmlElement. Then see the code snippet shown previously for how to get access to DOM and manipulate CDATA nodes. See DOM API for more details on handling CDATA.