You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Daniel Fagerstrom <da...@nada.kth.se> on 2004/11/10 13:37:26 UTC
XML support in Rhino 1.6
I took a look at the Rhino download page
http://www.mozilla.org/rhino/download.html and found to my suprise that
Rhino 1.6R1 (the version that we use in the trunk) includes ECMAScript
for XML (E4X). That makes XML a native data type in JS and let you do
XPath like things within the JS syntax, see
http://lxr.mozilla.org/mozilla/source/js/rhino/examples/E4X/e4x_example.js
for examples.
Quite cool IMO!
Now, to make it work one need to add xbean.jar from XMLBeans. I have not
had time to test it, though.
I didn't found any info about the stabillity of the implementation, how
it is related with SAX and DOM, if one can use it with external Java
implementations of SAX and DOM, and so on.
Really cool would it be if one could work on Java DOM trees with E4X
and/or if one could send E4X objects to the pipeline and serialize them
as SAX.
Maybe Igor can tell us more, I got the impression that he follow the list.
/Daniel
Re: XML support in Rhino 1.6
Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Luca Garulli wrote:
>On Wed, 10 Nov 2004 17:17:05 +0100, Luca Garulli <l....@gmail.com> wrote:
>
>
>>
>>
>>>Daniel Fagerstrom dijo:
>>>
>>>
>>>>I took a look at the Rhino download page
>>>>http://www.mozilla.org/rhino/download.html and found to my suprise that
>>>>Rhino 1.6R1 (the version that we use in the trunk) includes ECMAScript
>>>>for XML (E4X). That makes XML a native data type in JS and let you do
>>>>XPath like things within the JS syntax, see
>>>>http://lxr.mozilla.org/mozilla/source/js/rhino/examples/E4X/e4x_example.js
>>>>for examples.
>>>>
>>>>
>>>>
>>Very powerful... I'll test soon.
>>
>>
>
>Sorry for the triple msg... anyone know if that feature works also
>with flow & continuation?
>
That's the point :) Igor Bukanov has re-ported (or maybe reimplemented)
Christopher Olivers continuation aware fork of Rhino to the main
version. So Rhino 1.6 contains continuations. And thanks to Igor,
Rehinard and others work we use Rhino 1.6 for flowscripts in the trunk.
/Daniel
Re: XML support in Rhino 1.6
Posted by Luca Garulli <l....@gmail.com>.
On Wed, 10 Nov 2004 17:17:05 +0100, Luca Garulli <l....@gmail.com> wrote:
>
>
> > Daniel Fagerstrom dijo:
>
> > > I took a look at the Rhino download page
> > > http://www.mozilla.org/rhino/download.html and found to my suprise that
> > > Rhino 1.6R1 (the version that we use in the trunk) includes ECMAScript
> > > for XML (E4X). That makes XML a native data type in JS and let you do
> > > XPath like things within the JS syntax, see
> > > http://lxr.mozilla.org/mozilla/source/js/rhino/examples/E4X/e4x_example.js
> > > for examples.
> > >
>
> Very powerful... I'll test soon.
Sorry for the triple msg... anyone know if that feature works also
with flow & continuation?
bye,
Luca Garulli
www.Pro-Netics.com (member of Orixo.com - The XML business alliance)
OrienTechnologies.com - Light ODBMS, All in one JDO solution
Re: XML support in Rhino 1.6
Posted by Luca Garulli <l....@gmail.com>.
> Daniel Fagerstrom dijo:
> > I took a look at the Rhino download page
> > http://www.mozilla.org/rhino/download.html and found to my suprise that
> > Rhino 1.6R1 (the version that we use in the trunk) includes ECMAScript
> > for XML (E4X). That makes XML a native data type in JS and let you do
> > XPath like things within the JS syntax, see
> > http://lxr.mozilla.org/mozilla/source/js/rhino/examples/E4X/e4x_example.js
> > for examples.
> >
Very powerful... I'll test soon.
bye,
Luca Garulli
www.Pro-Netics.com (member of Orixo.com - The XML business alliance)
OrienTechnologies.com - Light ODBMS, All in one JDO solution
Re: XML support in Rhino 1.6
Posted by Antonio Gallardo <ag...@agssa.net>.
Daniel Fagerstrom dijo:
> I took a look at the Rhino download page
> http://www.mozilla.org/rhino/download.html and found to my suprise that
> Rhino 1.6R1 (the version that we use in the trunk) includes ECMAScript
> for XML (E4X). That makes XML a native data type in JS and let you do
> XPath like things within the JS syntax, see
> http://lxr.mozilla.org/mozilla/source/js/rhino/examples/E4X/e4x_example.js
> for examples.
>
> Quite cool IMO!
wow. It is amazing! I like the new rhino library!
Best Regards,
Antonio Gallardo
Re: XML support in Rhino 1.6
Posted by Reinhard Poetz <re...@apache.org>.
Daniel Fagerstrom wrote:
> Reinhard Poetz wrote:
>
>> Daniel Fagerstrom wrote:
>>
>>> I have looked a little bit more on it. It doesn't seem to work with
>>> the Rhino jar in the SVN. Rhino recognize the E4X syntax but it
>>> cannot find the XML class that is needed. The xbean.jar must be
>>> present during compilation AFAICS, probably our version is compiled
>>> without it. Maybe Reinhard know?
>>
>> It is compiled with it, but I haven't put the library into the
>> repository as I didn't know what it was used for and everything worked
>> as expected.
>>
>> Altough I don't feel very comfortable with having another ~2 megabyte
>> core reference :-(
>
> I agree with that. Maybe we can have an XMLBeans block that contains the
> lib and possibly some samples and nothing more. The STX block is like
> that. Anyway, we can try it out first.
It's also questionable whether we need the complete xmlbeans library. Maybe it
can be reduced.
--
Reinhard
Re: XML support in Rhino 1.6
Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Reinhard Poetz wrote:
> Daniel Fagerstrom wrote:
>
>> I have looked a little bit more on it. It doesn't seem to work with
>> the Rhino jar in the SVN. Rhino recognize the E4X syntax but it
>> cannot find the XML class that is needed. The xbean.jar must be
>> present during compilation AFAICS, probably our version is compiled
>> without it. Maybe Reinhard know?
>
>
> It is compiled with it, but I haven't put the library into the
> repository as I didn't know what it was used for and everything worked
> as expected.
>
> Altough I don't feel very comfortable with having another ~2 megabyte
> core reference :-(
I agree with that. Maybe we can have an XMLBeans block that contains the
lib and possibly some samples and nothing more. The STX block is like
that. Anyway, we can try it out first.
> I added it to our repository and a simple test worked for me
Cool! Maybe I forgot something when I tried it, I will try again.
> As trunk is considered alpha we can play with it and if we don't like
> it it can be deleted.
>
> Anyway, it seems really powerful and I'm looking forward to hearing
> from you more about it.
Don't hold your breath while waiting ;) The convertor stuff and some
CForms experiments related to that is higher up on my priority list. I'd
also like to go back to the JXTG refactoring again.
> Unfortunatly I don't have the time today to look deeper than a
> "<helloworld/>" into the details.
That is good enough, now we know that it works.
/Daniel
Re: XML support in Rhino 1.6
Posted by Reinhard Poetz <re...@apache.org>.
Daniel Fagerstrom wrote:
> I have looked a little bit more on it. It doesn't seem to work with the
> Rhino jar in the SVN. Rhino recognize the E4X syntax but it cannot find
> the XML class that is needed. The xbean.jar must be present during
> compilation AFAICS, probably our version is compiled without it. Maybe
> Reinhard know?
It is compiled with it, but I haven't put the library into the repository as I
didn't know what it was used for and everything worked as expected.
Altough I don't feel very comfortable with having another ~2 megabyte core
reference :-( I added it to our repository and a simple test worked for me
As trunk is considered alpha we can play with it and if we don't like it it can
be deleted.
Anyway, it seems really powerful and I'm looking forward to hearing from you
more about it. Unfortunatly I don't have the time today to look deeper than a
"<helloworld/>" into the details.
--
Reinhard
Re: XML support in Rhino 1.6
Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Sylvain Wallez wrote:
> Daniel Fagerstrom wrote:
>
>> I took a look at the Rhino download page
>> http://www.mozilla.org/rhino/download.html and found to my suprise
>> that Rhino 1.6R1 (the version that we use in the trunk) includes
>> ECMAScript for XML (E4X). That makes XML a native data type in JS and
>> let you do XPath like things within the JS syntax, see
>> http://lxr.mozilla.org/mozilla/source/js/rhino/examples/E4X/e4x_example.js
>> for examples.
>>
>> Quite cool IMO!
>
>
> I would say more: that kicks ass big time! The soap example is
> particularily impressive.
:)
I have looked a little bit more on it. It doesn't seem to work with the
Rhino jar in the SVN. Rhino recognize the E4X syntax but it cannot find
the XML class that is needed. The xbean.jar must be present during
compilation AFAICS, probably our version is compiled without it. Maybe
Reinhard know?
The implementation of E4X is based on XMLBeans,
http://xmlbeans.apache.org/. After having browsed the Rhino source
http://lxr.mozilla.org/mozilla/source/js/rhino/, I get the impression
that objects in the XML (whithin Rhino) class both can be constructed on
and return its internal o.a.xmlbeans.XmlObject. If this is true have a
lot of flexiblity.
XmlObject is the base interface in XMLBeans, it has methods so that an
XML object can be serialized to SAX and constructed from SAX. It can
also create a DOM or be initiated from a DOM. In the next version of
XMLBeans there will tighter intgration with DOM, an XmlBean will
implement the DOM interface as well, and no copying will be needed anymore.
For those who don't know about XMLBeans. It is a XMLSchema driven
XML-Java binding package. It uses XMLSchema to compile to Java classes
that makes it possible to access the XML tree in a bean style way, and
with full access to the XML Infoset. The XMLBeans provides access to the
XML leafs as ordinary Java data types, (int, long, Date etc). It also
have validation at subtree level.
IIRC Daisy use XMLBeans, so maybe some of the Outerthought guys can tell
more.
> Also, this could easily be turned into an "E4XGenerator" as yet
> another templating language.
Yes, if I'm right about the XmlBean access, it should be fairly easy to do.
/Daniel
Re: XML support in Rhino 1.6
Posted by Sylvain Wallez <sy...@apache.org>.
Daniel Fagerstrom wrote:
> I took a look at the Rhino download page
> http://www.mozilla.org/rhino/download.html and found to my suprise
> that Rhino 1.6R1 (the version that we use in the trunk) includes
> ECMAScript for XML (E4X). That makes XML a native data type in JS and
> let you do XPath like things within the JS syntax, see
> http://lxr.mozilla.org/mozilla/source/js/rhino/examples/E4X/e4x_example.js
> for examples.
>
> Quite cool IMO!
I would say more: that kicks ass big time! The soap example is
particularily impressive.
Also, this could easily be turned into an "E4XGenerator" as yet another
templating language.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Re: XML support in Rhino 1.6
Posted by Luca Garulli <l....@gmail.com>.
On Wed, 10 Nov 2004 13:37:26 +0100, Daniel Fagerstrom
<da...@nada.kth.se> wrote:
> I took a look at the Rhino download page
> http://www.mozilla.org/rhino/download.html and found to my suprise that
> Rhino 1.6R1 (the version that we use in the trunk) includes ECMAScript
> for XML (E4X). That makes XML a native data type in JS and let you do
> XPath like things within the JS syntax, see
> http://lxr.mozilla.org/mozilla/source/js/rhino/examples/E4X/e4x_example.js
> for examples.
Very powerful... I'll test it soon.
bye,
Luca Garulli
www.Pro-Netics.com (member of Orixo.com - The XML business alliance)
OrienTechnologies.com - Light ODBMS, All in one JDO solution