12.42. Configuring the SAXToXMLWriter
- When writing a
SAXVisitor
implementation with theSAXToXMLWriter
, set theSAXToXMLWriter
constructor to a boolean. This is theencodeSpecialChars
arg and it should be set based on therewriteEntities
filter setting. - Move the
@StreamResultWriter
annotation from the class and onto theSAXToXMLWriter
instance declaration. This results in Smooks creating theSAXToXMLWriter
instance which is then initialized with therewriteEntities
filter setting for the associated Smooks instance:@TextConsumer public class MyVisitor implements SAXVisitAfter { @StreamResultWriter private SAXToXMLWriter xmlWriter; public void visitAfter(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { xmlWriter.writeStartElement(element); xmlWriter.writeText(element); xmlWriter.writeEndElement(element); } }