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 Question
Date Mon, 22 Dec 2003 23:14:12 GMT
On Tue, 2003-12-23 at 11:45, Juan Alvarado wrote:
> Hello:
> 

Hi Juan,

In the CVS repository there are now some examples of using Digester that
will hopefully answer your questions. You can see these examples by
following the instructions for checking out files from CVS, or use the
CVS web interface to browse/download the files.

See:
http://cvs.apache.org/viewcvs.cgi/jakarta-commons/digester/src/examples/

The page http://jakarta.apache.org/commons/digester/ has a Resources
section that contains links to some published articles about Digester
that may also be useful.

You should make sure you read the package description for digester.
Follow the instructions in the "Documentation" section of the page
linked above.

> As you can see, the node <DebitRequests ReportSuccesses="true"> 
> contains an attribute ReportSuccesses="true". I need to be able to grab 
> that value so that it can be populated into my corresponding bean. 
> Additionally there might be times when there is more than one attribute 
> in a given node and obviously I would need to get those values also. 
> Could someone please tell me if this is possible and if so, how to 
> accomplish this.

It is definitely possible to map xml attributes to properties in your
classes. The examples demonstrate how to do this.

> 
> NEXT QUESTION:
> 
> My application not only has to parse this XML stream, but we also have 
> to create this XML from in certain situations. We might for example 
> receive a request through the web with the necessary parameters and 
> values needed to construct the XML and then pass on to the next layer. 
> Can anyone tell me if the digester framework can handle this and if so, 
> I'd appreciate some sample code.

If you are asking about converting a set of CGI parameters to XML, then
no Digester won't help with this.

If you are asking about converting a tree of java objects into an XML
representation ("serializing to xml") then you should have a look at
"betwixt" which is also a Jakarta Commons project.

Digester only handles xml->objects, not objects->xml.

> 
> Thanks in advance.

You're welcome. If you have more questions after reading the docs feel
free to ask. One minor note: by convention emails in this list should
have the project listed in square brackets, eg
  "[digester] how to handle xml attributes?"

Subscribers to this list often filter emails using this pattern, so if
you don't use it then your email might not reach the right people...

Regards,

Simon



---------------------------------------------------------------------
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