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.




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

Reply via email to