Reputation: 7827
i have written a java code for updating the element value with the following string
<![CDATA[test]]>
but its saved in the xml file in the following manner
<value><![CDATA[test]]></value>
how to avoid these any suggestions.
Upvotes: 2
Views: 410
Reputation: 149017
If you are using DOM then you need to create a CDATA node instead of setting the block in a text node.
document.createCDATASection("foo");
Upvotes: 5
Reputation: 28074
It did exactly what you wanted. The stored data represents the String "<![CDATA[test]]>"
!
If you use a API to create XML, just don't care for the way the XML is generated, since any parser will be able to parse it correctly. Just store the String "test"
and be happy :).
Upvotes: 0