You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Tim O'Brien <to...@discursive.com> on 2003/06/10 16:39:06 UTC

Re: [DIGESTER] Newbie : Voice XML Implementation ?

On Tue, 2003-06-10 at 11:06, Shahed Moolji wrote:
> By reading the intro to Digester, it looks like the right tool to build such
> an application.

I'm partial to Digester, but in the interest of "full disclosure", there
is another tool named Castor which might also be of use. It is available
from Exolab - http://www.exolab.org . Castor seems to have a lower
conceptual barrier to entry, but in terms of performance and usability,
I've found Digester to be leaner and more flexible.

> 1. Has anyone out there implemented VXML using Digester ?
Not I, but it wouldn't be very difficult to implement.  From what I see
in the VoiceXML 2.0 spec, it should be too difficult to come up with an
XML ruleset definition and an object model for VoiceXML 2.0.  Please, if
you do this consider placing it under an Apache style license and
contributing the code.

> 2. Are there any good examples that show me how to use digester other than
> to parse a config file ?

I'm assuming you'd want to parse VoiceXML into some sort of hierarchical
object model, that is not dissimilar from the way that RSS is parsed in
Digester or the way the config files in Struts are parsed. 

There are a few places to find examples of using the Digester, 

EXAMPLE 1. Digester Ships with a "Demo" that can "digest" RSS - Look at
the source code of Digester, and you'll see a package
org.apache.commons.digester.rss.  You'll find two RSS DTDs and Example
XML file for RSS, some objects, and a class named RSSDigester.java. 

http://cvs.apache.org/viewcvs/jakarta-commons/digester/src/java/org/apache/commons/digester/rss/RSSDigester.java?rev=1.5&content-type=text/vnd.viewcvs-markup

RSSDigester contains programmatic statements to create a parser for RSS,
you can use this as a model for implementing your own Digester.  You
should take note that the RSSDigester is somewhat obsoleted by the
ability to specify digester rule sets in an XML file.  Just be aware
that, a better approach would involve taking the contents of the
configure() function in RSSDigester, putting these into an XML file, and
then creating a Digester instance from this configuration file.

EXAMPLE 2. The Test cases:
http://cvs.apache.org/viewcvs/jakarta-commons/digester/src/test/org/apache/commons/digester/ . This might be a little confusing for someone very new to Digester, but once you get a hold of using the Digester from Example 1, looking at the source code for the test cases will shed light on the available feature-set.

EXAMPLE 3. Find another project that depends on the commons-digester -
You can look at a number of project through jakarta-gump's website, and
find a project that depends on Digester - like say the "older brother"
of Digester - jakarta-struts.  Here is a class similar to RSSDigester
for Struts -
http://cvs.apache.org/viewcvs/jakarta-struts/src/share/org/apache/struts/config/ConfigRuleSet.java?rev=1.14&content-type=text/vnd.viewcvs-markup

As you can see, a number of projects that depend on Struts still use the
programmatic definition of the rule sets in Java code.  These
implementations can all just as easily be implemented using an XML rule
set definition.




RE: [DIGESTER] Newbie : Voice XML Implementation ?

Posted by Kevin Ross <Ke...@iverticalleap.com>.
In the case you want to deal with/alter/omit/emit sax events, I find
Jelly an excellent tool.

-Kevin Ross

-----Original Message-----
From: robert burrell donkin
[mailto:robertburrelldonkin@blueyonder.co.uk] 
Sent: Tuesday, June 10, 2003 4:40 PM
To: Jakarta Commons Users List
Subject: Re: [DIGESTER] Newbie : Voice XML Implementation ?

the typical digester use case is xml->java mappings. most of the example

code out there following this pattern.

if i understand you correctly, you intend to create a event driven 
architecture rather than a processed-custom-object-model architecture. 
this sounds pretty interesting - if your implementation is going to be 
open source i'd be interested to take a look sometime (if i ever hav any

free time again).

SAX is the classic way to build event driven xml applications. the
problem 
with SAX is that the events are low level with xml symantics. beyond a 
certain complexity, using a SAX wrapper to add a layer of abstraction
can 
make things easier. digester is one such layer. digester wraps SAX and 
allows higher level processing by rules - actions executed when the 
element path matches according to a flexible set of matching rules.

this design means that it should be possible to create event driven 
applications using digester rules to create higher level ones - but i'm 
not aware of anyone who's explored this use case. maybe scott (if he's
out 
there) has.

anyway, i'd say that digester is a better match than a xml->object
mapper 
and that if digester is not appropriate, you might need to use SAX 
directly.

- robert

On Tuesday, June 10, 2003, at 08:54 PM, Shahed Moolji wrote:

> I have used Castor more than a year ago for XML->Java mappings.
>
> But it did not seem to have the ability to generate "events" as it
parsed
> the document.
> All it did was convert an xml file to a bean and vice-versa.
>
> Perhaps a lot has happened since then ?
>
>
> I am also looking at OpenVXI, but thats written in C/C++, and
> I may just write a Java Wrapper for that ?
>
> Anyway my first instinct is to go with digester .....
>
> Thanks for your input.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [DIGESTER] Newbie : Voice XML Implementation ?

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
the typical digester use case is xml->java mappings. most of the example 
code out there following this pattern.

if i understand you correctly, you intend to create a event driven 
architecture rather than a processed-custom-object-model architecture. 
this sounds pretty interesting - if your implementation is going to be 
open source i'd be interested to take a look sometime (if i ever hav any 
free time again).

SAX is the classic way to build event driven xml applications. the problem 
with SAX is that the events are low level with xml symantics. beyond a 
certain complexity, using a SAX wrapper to add a layer of abstraction can 
make things easier. digester is one such layer. digester wraps SAX and 
allows higher level processing by rules - actions executed when the 
element path matches according to a flexible set of matching rules.

this design means that it should be possible to create event driven 
applications using digester rules to create higher level ones - but i'm 
not aware of anyone who's explored this use case. maybe scott (if he's out 
there) has.

anyway, i'd say that digester is a better match than a xml->object mapper 
and that if digester is not appropriate, you might need to use SAX 
directly.

- robert

On Tuesday, June 10, 2003, at 08:54 PM, Shahed Moolji wrote:

> I have used Castor more than a year ago for XML->Java mappings.
>
> But it did not seem to have the ability to generate "events" as it parsed
> the document.
> All it did was convert an xml file to a bean and vice-versa.
>
> Perhaps a lot has happened since then ?
>
>
> I am also looking at OpenVXI, but thats written in C/C++, and
> I may just write a Java Wrapper for that ?
>
> Anyway my first instinct is to go with digester .....
>
> Thanks for your input.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


Re: [DIGESTER] Newbie : Voice XML Implementation ?

Posted by Shahed Moolji <sh...@enoor.com>.
I have used Castor more than a year ago for XML->Java mappings.

But it did not seem to have the ability to generate "events" as it parsed
the document.
All it did was convert an xml file to a bean and vice-versa.

Perhaps a lot has happened since then ?


I am also looking at OpenVXI, but thats written in C/C++, and
I may just write a Java Wrapper for that ?

Anyway my first instinct is to go with digester .....

Thanks for your input.