Example usage for org.apache.commons.jelly XMLOutput endDocument

List of usage examples for org.apache.commons.jelly XMLOutput endDocument

Introduction

In this page you can find the example usage for org.apache.commons.jelly XMLOutput endDocument.

Prototype

public void endDocument() throws SAXException 

Source Link

Document

Receive notification of the end of a document.

Usage

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  . j a v  a  2  s . co m

    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();
}