@Override public int doEndTag() throws JspException { try { Source source = xmlSpecified ? getSourceFromXmlAttribute() : getSourceFromBodyContent(); // Conduct the transformation if (var != null) { // Save the result to var. Document d = XmlUtil.newEmptyDocument(); Result doc = new DOMResult(d); t.transform(source, doc); pageContext.setAttribute(var, d, scope); } else { // Write to out if result is not specified. Result out = result; if (out == null) { out = new StreamResult(new UnclosableWriter(pageContext.getOut())); } t.transform(source, out); } return EVAL_PAGE; } catch (TransformerException ex) { throw new JspException(ex); } catch (SAXException e) { throw new JspException(e); } catch (ParserConfigurationException e) { throw new JspException(e); } finally { t = null; } }
@Override public int doEndTag() throws JspException { try { Source source = xmlSpecified ? getSourceFromXmlAttribute() : getSourceFromBodyContent(); // Conduct the transformation if (var != null) { // Save the result to var. Document d = XmlUtil.newEmptyDocument(); Result doc = new DOMResult(d); t.transform(source, doc); pageContext.setAttribute(var, d, scope); } else { // Write to out if result is not specified. Result out = result; if (out == null) { out = new StreamResult(new UnclosableWriter(pageContext.getOut())); } t.transform(source, out); } return EVAL_PAGE; } catch (TransformerException ex) { throw new JspException(ex); } catch (SAXException e) { throw new JspException(e); } catch (ParserConfigurationException e) { throw new JspException(e); } finally { t = null; } }