tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: Request for expert advice on design
Date Sun, 09 Sep 2001 19:47:51 GMT
Hi Ray

Sorry for the delay getting back - just catching up after vacation.

Firstly, this sounds interesting - more comments intermixed.

----- Original Message -----
From: "Ray Allis" <>
> [Newbie, a bit overwhelmed]
> Building a NewsML application using dbXML ( Struts
> framework: jakarta-struts-1.0, jakarta-tomcat-4.0-b7, JSE (build
> 1.3.1-b24), jakarta-taglibs-jsptl-20010830, xtags-20010620.tar.gz ...
> Simple application: add, modify, delete XML documents in the dbXML
> database, then arrange them (e.g. combine several documents) for XSLT ->
> HTML, WML...
> A database query returns a "ResourceIterator", for a "ResourceSet".
> Each XMLResource:
>     "Provides access to XML resources stored in the database.
>     An XMLResource can be accessed either as text XML or via
>     the DOM or SAX APIs.
>     The default behavior for getContent and setContent is to
>     work with XML data as text so these methods work on String
>     content."
> So, ;-) is there an elegant way to deal with these objects using JSP?

Sure - I think you just need to decide how the JSP should look and what the
tags look like.

> - Should I work on a jsptl lib for dbxml? (jx:forEach doesn't
>    know how to iterate Resources.) Or just use inline
>    scriptlets for e.g. iteration until jsptl settles down a bit?

A taglib to be able to find and iterate over dbXML resources sounds a great
idea. Then the developer can decide if they wish the resource to be output
as SAX, dom4j, DOM, text or whatnot.

Something like this might be nice

<dbxml:forEachResource query="whateverYouPassIntoDbXML">
    <!-- parse the output as text to use XTags to do XPath... -->

    <!-- output the XML resource as a DOM so that some other code could use
it -->
    <dbxml:asDOM variable="myvar"/>

Then with just a few tags the dbxml taglib could work with XTags or other
JSP taglibs via dom4j, text, SAX or whatnot.

> - Once I extract an "XMLResource" do I pass it to xtags for
>    select etc.?

If you want to yes. Or you could pass it straight into the XSLT tag
<xtags:style> if you want to. If you could output a dbXML resource as a JAXP
javax.xml.transform.Source it would be really cool and easy to work with

> Do I pass a String to xtags:parse for each
>    XMLResource?  Is this where "Tag Collaboration" applies?

Sure if you like. Either via text (then you can do tag nesting) or via
scriplets or attributes.

>    Is xtags even the applicable tool?

It certainly could be.

> - Eventually, I'd like to do form-based database maintenance.
>    :-) The Documents are in beans, but how would a setWhatever
>    work?  The present technique would be to build new or
>    replacement Documents complete using xtags and insert them
>    into the db?

XSLT tends to take the view that you take an existing document and create a
whole new output document.

In XTags you can actually amend an existing document iteratively - e.g. find
all the <foo> elements with certain attribute values using XPath then add or
delete things. So to do iterative modification to an XML document, you can
use XTags if you like. Especially if you were doing something like NewsML
editing, where you just want to (say) edit the title or author's name,
there's no point creating a whole new document with XSLT just to do
incremental changes. There's folks doing this kind of thing with XTags today
(using documents quite like NewsML and XML CMS type stuff)

> Or is there a jdom.tld in the works? ;-)

Dunno what the jdom.tld is ;-)

>    (There IS an XUpdate for xmldb. :-)
> Please don't take this as a request to do the work for me. (Honest! ;))
> But if someone could give me a few sentences of high-level view of the
> way this -should- be done, maybe I could avoid the paths to the swamps.

There's a few ways to go but I think as a start a dbXML taglib could be
really useful for dbXML users. As it happens there's been some work at
working with dbXML on the dom4j project (which currently XTags uses for its
XML & XPath functionality) - if you want to find out more, I'd mail the
dom4j-dev list ( for more details), in particular Toby's
working on it.

So long as the dbXML taglib allows the XML resources to be output as SAX and
text it should be resuable with XSLT taglibs (such as XTags and one day
JSPTL too) as well as XPath based taglibs like XTags.


View raw message