Bugs item #1735733, was opened at 2007-06-12 15:58 Message generated for change (Comment added) made by agiotis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1735733&group_id=16035
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Alexios (agiotis) Assigned to: Nobody/Anonymous (nobody) Summary: XMLWriter escapes text inside CDATA sections Initial Comment: When the org.dom4j.io.XMLWriter is used as a LexicalHandler then text inside the CDATA sections is escaped: SAXWriter saxWriter = new SAXWriter(filter); XMLWriter xmlWriter = new XMLWriter(outputStream); filter.setContentHandler(xmlWriter); saxWriter.setLexicalHandler(xmlWriter); saxWriter.write(dom4jDocument); We need to put a private boolean flag inside the XMLWrite r that will be changed on startCDATA() and endCDATA() events to stop escaping text received by the characters() method. ---------------------------------------------------------------------- >Comment By: Alexios (agiotis) Date: 2007-06-12 17:03 Message: Logged In: YES user_id=1458452 Originator: YES A quick workaround is to use the following subclass: public class XMLWriter extends org.dom4j.io.XMLWriter { public XMLWriter(OutputStream outputStream) throws UnsupportedEncodingException { super(outputStream); } /** Keeps the original escapeText value */ private boolean escapeText; @Override public void startCDATA() throws SAXException { super.startCDATA(); escapeText = isEscapeText(); setEscapeText(false); } @Override public void endCDATA() throws SAXException { super.endCDATA(); setEscapeText(escapeText); } } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1735733&group_id=16035 ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ dom4j-dev mailing list dom4j-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-dev