Ce contenu n'est pas disponible dans la langue sélectionnée.
12.36. Implementing the SAXVisitor
- To implement a
SAXVisitor
geared towards transforming the serialized form of a fragment, program Smooks so theSAXVisitor
implementation will be writing to theStreamResult
. This is because Smooks supports targeting of multipleSAXVisitor
implementations at a single fragment, but only oneSAXVisitor
is allowed to write to theStreamResult
, per fragment. - If a second
SAXVisitor
attempts to write to theStreamResult
, aSAXWriterAccessException
will result and you will need to modify your Smooks configuration. - To specify the
StreamResult
to write, theSAXVisitor
needs to "acquire ownership" of theWriter
to theStreamResult
. It does this by making a call to theSAXElement.getWriter(SAXVisitor)
method from inside theSAXVisitBefore.visitBefore
methods implementation, passingthis
as theSAXVisitor
parameter.