[jdom-interest] Extending JDOM Outputter

ajalis at csoft.net ajalis at csoft.net
Wed Oct 18 16:54:10 PDT 2000

I have been working on an idea to create a thin fast template engine
that sits on top of JDOM.

A lot of XML data that is parsed ends up being used to generate other
types of text -- other XML text or HTML text, or sometimes SQL commands,
etc. So a templating engine would be a good fit with JDOM. It would
extend JDOM in a natural direction and simplify the whole process of
generating other types of text from XML.

The specific application that I am interested in is this: running a
large website and templates to generate several million very similar
looking web-pages every day pulling in data as XML.

The template model I have in mind is something similar to the
HTML::Template module in Perl (see http://search.cpan.org).

The template syntax would be simpler than XSLT and would contain minimal
computation -- the job of the template engine would be to present
processed XML, fast.

Some questions: How does your open source project work? Can I join it
and contribute this piece of code? Does someone need to approve of this
idea? Is there something already in JDOM or that can be integrated with
JDOM that does this?

I have looked at WebMacro and here are some things I don't like about
it: (a) It's design is servlet optimized. (b) It is too fat. (c) It is
slow. (b) and (c) are consequences of (a).

Another subtler problem is that to access elements inside the template
requires tags like $root.getChild("name").getContent(). This
can be solved by first creating an even simpler way to
address/access elements and attributes in JDOM: something like
getContent("root.element.subelement").  This returns the content of
subelement. getContent("root.element.subelement[attr]") can return the
content of this particular attribute.

This would allow the templates to contain tags like
${root.element.subelement} and have this be replaced with the content
from subelement.

The other main constructs in the template syntax would be:

(a) An iteration construct.

(b) A conditional construct.

(c) A subroutine or macro construct.

I have not worked with open source projects before so I am not sure
how this process is supposed to work.

Does anyone have any input on this? Please feel free to respond.


More information about the jdom-interest mailing list