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

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

Introduction

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

Prototype

public void startDocument() throws SAXException 

Source Link

Document

Receive notification of the beginning 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   w w  w  . j  a va 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();
}