2

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>&lt;![CDATA[test]]&gt;</value> 

how to avoid these any suggestions.

0

3 Answers 3

5

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");
Sign up to request clarification or add additional context in comments.

Comments

0

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 :).

Comments

0

Use API Document.createCDATASection to create the CDATA.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.