You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Laurent Eskenazi <le...@mail.inforama.fr> on 2000/02/07 17:37:05 UTC

XObject

Hi!

I've got a few java classes I want to include in a cocoon project. There are
several hundred lines of code so I want to keep these out of the xml/xsp
files and just want to instantiate and call methods in the xml/xsp files.

 I wandered around and found the XObject interface wich seems to suit me. It
is stated that "This interface must be implemented by classes willing to
provide an XML representation of their current state", and that's exactly
what I want to do.

So I implemented this interface for one of my object, but I only did the
toSax() method leaving every thing else empty. And nothing happened =+(

After looking in Cocoon source code, I understood that the toSAX() method
wasn't currently used. So I'm now ready to re-do the job using the toDOM()
method. But is this the good way ? I have very few information about the
XObject class. Is there a place where I could find informations about this
class ? Has anybody some samples I could study ?

Thanks per advance

Laurent



Re: XObject

Posted by Laurent Eskenazi <le...@mail.inforama.fr>.
> XObject is the interface that must be implemented by classes performing
> like "XBeans", which are beans that are able to "express" themselves
> spitting an XML representation of themselves. So, yes, this is what they
> are useful for. (sorry, for not having understood this before, Laurent!)

Thank you very much...I'm on the good way now.
By the way, I think that the documentation is rather poor concerning this
topic. I suppose the cocoon team is very busy, but it would be nice to see
the java/developer side of the doc expanded.

Just a last thing: I am located in Sophia Antipolis, France, and i'd like to
meet other people using cocoon to share experiences. Does anybody on the
list is from the french rivierra ?

Thanks

Laurent


Re: XObject

Posted by Stefano Mazzocchi <st...@apache.org>.
Laurent Eskenazi wrote:
> 
> Hi!
> 
> I've got a few java classes I want to include in a cocoon project. There are
> several hundred lines of code so I want to keep these out of the xml/xsp
> files and just want to instantiate and call methods in the xml/xsp files.
> 
>  I wandered around and found the XObject interface wich seems to suit me. It
> is stated that "This interface must be implemented by classes willing to
> provide an XML representation of their current state", and that's exactly
> what I want to do.
> 
> So I implemented this interface for one of my object, but I only did the
> toSax() method leaving every thing else empty. And nothing happened =+(
> 
> After looking in Cocoon source code, I understood that the toSAX() method
> wasn't currently used. So I'm now ready to re-do the job using the toDOM()
> method. But is this the good way ? I have very few information about the
> XObject class. Is there a place where I could find informations about this
> class ? Has anybody some samples I could study ?

XObject is the interface that must be implemented by classes performing
like "XBeans", which are beans that are able to "express" themselves
spitting an XML representation of themselves. So, yes, this is what they
are useful for. (sorry, for not having understood this before, Laurent!)

Anyway, XObject was created ahead of time, thinking for SAX support that
is currently under development. So, the answer is:

1) for now, use toDOM
2) in the future, use toSAX

So, a good way to do it is

a) implement toSAX()
b) implement toDOM() with a SAX2DOM wrapper.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!  
------------------------- http://ApacheCon.Com ---------------------