Barracuda: XML Template Example
simon wilks <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <1038823192.1746.173.camel@ELINB026> |
hi,
I am trying to introduce Barracuda into my existing system which
generates a generic markup language (XML) which will then be tranformed
by a proxy (using XSLT) into the appropriate ML based on the requestors
device type.
Using the HTML templates is no problem as there are many examples
available but I am missing the point somewhere when I try to use XML
templates.
I am getting XMLC to generate the appropriate code from my XML template,
although when I attempt to bind the Node (id="MainScreen") it is not
being returned. I have also noticed in the Barracuda log that my
templates are still being treated as HTML is someway.
As you can see, I am lost :-)
Are there any examples out there of how to handle XML content using
XMLObject? That would help me enourmously!!!
Here is an extract from where things go wrong at the moment.
class RenderMainScreenHandler extends DefaultBaseEventListener {
public void handleViewEvent(ViewEventContext context)
throws EventException, ServletException, IOException {
...
...
...
MainScreenXML page =(MainScreenXML)
DefaultDOMLoader.getGlobalInstance().getDOM(MainScreenXML.class,
locale);
Node node = page.getDocument().getElementById("MainScreen");
BTemplate templateComp = new BTemplate(new
GenericScreenModel(strScreenName));
templateComp.setView(new DefaultTemplateView(node));
try {
templateComp.render(new DefaultViewContext(context));
} catch (RenderException re) {
logger.warn(strScreenName + " Render failed. Reason: "+re);
}
new DefaultDOMWriter().write(page, context.getResponse());
}
}
Thanks!
Simon Wilks
_______________________________________________
Barracuda mailing list
[email protected]
http://www.enhydra.org/mailman/listinfo.cgi/barracuda
FAQ - http://www.jguru.com/faq/Barracuda