Show Table of Contents
12.36. Implementing the SAXVisitor
- To implement a
SAXVisitorgeared towards transforming the serialized form of a fragment, program Smooks so theSAXVisitorimplementation will be writing to theStreamResult. This is because Smooks supports targeting of multipleSAXVisitorimplementations at a single fragment, but only oneSAXVisitoris allowed to write to theStreamResult, per fragment. - If a second
SAXVisitorattempts to write to theStreamResult, aSAXWriterAccessExceptionwill result and you will need to modify your Smooks configuration. - To specify the
StreamResultto write, theSAXVisitorneeds to "acquire ownership" of theWriterto theStreamResult. It does this by making a call to theSAXElement.getWriter(SAXVisitor)method from inside theSAXVisitBefore.visitBeforemethods implementation, passingthisas theSAXVisitorparameter.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.