Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is there any way to preserve character sequences in an XmlDataSet if they are explicitly stored in the database?

0
Posted

Is there any way to preserve
character sequences in an XmlDataSet if they are explicitly stored in the database?

0

You can easily extend the XmlDataSet class and overwrite the methods that write the string values as follows: public class MyXmlWriter extends org.dbunit.dataset.xml.XmlDataSetWriter { … protected void writeValueCData(String stringValue) throws IOException { int k = 0; while((k = str.indexOf(‘\r’)) != -1){ getXmlWriter().writeCData(str.substring(0, k)); getXmlWriter().writeText(“\r”, true); str = str.substring(k + 1); } getXmlWriter().writeCData(str); } protected void writeValue(String stringValue) throws IOException { // Write literally super.getXmlWriter().

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123