List of usage examples for org.apache.commons.jelly XMLOutput XMLOutput
public XMLOutput(ContentHandler contentHandler)
From source file:org.kohsuke.stapler.jelly.groovy.JellyBuilder.java
/** * Captures the XML fragment generated by the given closure into dom4j DOM tree * and return the root element./* ww w . j av a 2 s .c o m*/ * * @return null * if nothing was generated. */ public Element redirectToDom(Closure c) { SAXContentHandler sc = new SAXContentHandler(); with(new XMLOutput(sc), c); return sc.getDocument().getRootElement(); }
From source file:org.sapia.soto.state.cocoon.view.JellyView.java
protected void execute(Object model, Map viewParams, ContentHandler handler) throws Throwable { if (_jelly == null) { throw new IllegalStateException("Jelly script not set on Jelly view"); }/*from ww w . ja v a 2 s . c om*/ if (_lastModified != _res.lastModified()) { reload(); } JellyContext jelly = new JellyContext(); JellyUtils.copyParamsTo(jelly, viewParams); jelly.setCurrentURL(new URL(_res.getURI())); jelly.setVariable(CocoonContext.MODEL_KEY, model); Param p; for (int i = 0; i < _params.size(); i++) { p = (Param) _params.get(i); if (p.getName() != null && p.getValue() != null) { jelly.setVariable(p.getName(), p.getValue()); } } XMLOutput output = new XMLOutput(handler); output.startDocument(); _jelly.run(jelly, output); output.endDocument(); }