commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <si...@ecnetwork.co.nz>
Subject Re: [Digester]How to access created objects
Date Tue, 04 Nov 2003 22:15:07 GMT
Hi Frank,

You may wish to check out the current digester source code from the cvs
repository, or use CVSWeb to browse it.

You will find code in src/examples/api which may be useful to you.

These examples were added since the last release, so you'll need to
access them from the cvs repository. See the jakarta website for
instructions on how to do this.

Just a general note: Digester is not related to servlets in any way. It
can be used within a servlet if you wish, or used in applications that
have nothing to do with servlets. 

The way digester is generally used is that you give it some rules and
some input xml, and it generates a tree of objects. You never need to
access the digester "stack" from your code; you just get the object
representing the root of the tree and use its methods.

Note that by "tree" I don't mean that Digester generates an explicit
tree. If your objects represent the data in the xml input file, then by
definition your objects represent a tree, because that is how xml is
structured. All the articles you reference demonstrate this, as do the
examples in cvs.

Regards,

Simon

On Wed, 2003-11-05 at 05:58, Frank Schaare wrote:
> Hi,
> 
> i try to get familiar with the digester. Therefore i read all three (not 
> very much) articles mentioned on digesterĀ“s homesite and tried some code 
> like this:
> 
>  public void initSQLRules()
>  {
>   try
>   {
>   Digester digester = new Digester();
>   digester.push(this);
>   
>   digester.addObjectCreate("Abfragen",Abfragen.class);
>   
>   digester.addObjectCreate("Abfragen/Abfrage",Abfrage.class);
>   digester.addBeanPropertySetter("Abfragen/Abfrage/Name","name");
>   digester.addBeanPropertySetter("Abfragen/Abfrage/SQL","wert");
>   digester.addSetNext("Abfragen/Abfrage","addAbfrage");
>   
>   digester.parse("my.xml");  
>  
>   }
>   catch (Exception e)
>   {
>   e.printStackTrace();
>   }
>   
>  }
> 
> This seems to work, what exactly happen here ? Obviously, the digester 
> gets some rules an delegates xml parsing to a SAXParser.
> 
> How do i access (get) the generatet Bean ?
> Where is the bean object createt ?
> 
> Who has information about this mysterios stack ? The Code 
> 'digester.push(this);' seems to put the servlet instance on a stack. 
> What for ?
> 
> Are there any sites that gain a little more information as jakarta does ?
> 
> thx for your answers.
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message