Code example for SAXSource

0
                if (request.needTransform()) {
                    transformer = createTransformer(source);
                } 
                if (transformer != null && transform) {
                    response.setContentType(TEXT_HTML);
                    final SAXSource saxSource = new SAXSource(yaletFilter, inputSource);
                    transformer.transform(saxSource, new StreamResult(stream));
                } else { 
                    response.setContentType(TEXT_XML);
                    yaletFilter.setContentHandler(new MyXMLSerializer(stream));
                    yaletFilter.parse(inputSource);
                } 
            } finally { 
                stream.close();
            } 
 
            final String redir = response.getRedir();
            final String contentType = response.getContentType();
            if (contentType != null && !contentType.contains(TEXT_HTML) && !contentType.contains(TEXT_XML)) {
                log.info("Content-Type: " + response.getContentType());
            } else if (redir == null || !response.getErrors().isEmpty()) {