Hi,

The parsed-document format is what I'm after - I don't care about SAX events.

I am building a set of UI widgets that can be dynamically attached to nodes in DOM 
tree via templates that describe the mapping from the tree to the widgets. In addition 
to being able to actively read & write data to and from the DOM tree, the widgets need 
to be notified when the tree changes.

I am using DOM level 2 events (interfaces from org.w3c.dom.events), in particular 
Mutation events, to provide this notification. The Xerces DOM implementation supports 
this - I can cast any Node object to an EventTarget and attach event listeners to the 
node.

I want to coordinate all this stuff from Jelly (I'm also creating Jelly tags for my 
widgets), something like this:

    <xml:parse var="doc" xml="foo.xml"/>

    <myTreeControl node="${doc}" ... />

myTreeControl wants a DOM node that supports events, but the built-in parse tag 
produces a dom4j node which does not support them out of the box. So I just made my 
own xml parsing tag that produces a Xerces DOM node instead.

This works fine, but it's not well integrated. For example, If I were using the 
built-in xml tags, I could use the resulting nodes in Xpath expressions something like 
this:

    <myTreeControl node="${doc}/foo/bar" ... />

and let Jelly evaluate the expression for me. But since my nodes are not the dom4j 
nodes expected, I have to do something like this instead:

    <myTreeControl node="${doc}" path="foo/bar" ... />

and construct the desired Xpath expression myself.

I think the best way to get what I want is to plug in an implementation of the various 
dom4j interfaces that also implement the org.w3c.dom.events interfaces - probably by 
delegating to the Xerces DOM implementation. That should be transparent to Jelly. I 
was just curious if anyone else had faced similar issues....

While I'm at it... In the course of the work I'm doing, I am making a number of fixes, 
enhancements, and additions to various Jelly tags, mostly Jelly-Swing. What would be 
the best way for me to contribute these changes back to the project?

Regards,
Scott

-----Original Message-----
From: Paul Libbrecht [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 20, 2003 3:57 AM
To: Jakarta Commons Users List
Subject: Re: [jelly] Integrating DOM event support into Jelly XML handling


Can you be more precise as to what kind of DOM-events you expect ?

Also, what kind of XML-tags, do you mean ?
DOM could be used relatively easily as a source of SAX events (which is 
what the tags do send to their parents as a base jelly function, it's 
not dom4j which is only used as a parsed-document format).

(note, I think Jaxen, which is the base of XPath evaluation in the XML 
tag-library), does support dom...

Paul

On Mercredi, ao�t 20, 2003, at 02:59 Europe/Paris, Scott Howlett wrote:

> Hello,
>
> I am exploring the use of Jelly in an environment where my XML nodes 
> need to support DOM events. The problem is that Jelly's XML support 
> comes mainly through dom4j, whose out-of-the-box implementation 
> doesn't do this.
>
> I believe I have three possibilities:
>
> 1. Roll my own XML tags based on a DOM implementation (Xerces) that 
> supports such events. I've been doing this so far because it's easy, 
> but I'd like better integration.
>
> 2. Factor out Jelly's XML support so that its XML support could be 
> pluggable (plug in Xerces DOM instead of dom4j for example). This 
> sounds like a non-starter.
>
> 3. Provide an implementation of the dom4j interfaces that delegates to 
> an implementation like Xerces DOM.
>
> Does anyone have suggestions about possible approaches that I might be 
> missing?
>
> Thanks,
> Scott Howlett

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to