On Fri, 2004-10-08 at 07:11, Nalika Dissanayaka wrote: > Hi, > > I am having a difficulty to load the following XML file by using the > commons Digester. Is there anyone that can help me on this... > > XML FILE > > <?xml version="1.0" encoding="UTF-8"?> > <metadata lang="en-US" environment="Production" revision="001"> > <Sender> > <Name>my nameDC</Name> > <Address>my address </Address> > </Sender> > <DataArea> > <Data Set> > <Data> > <attr1></attr1> > <attr2></attr2> > > <attrn></attrn> > > </Data> > <Data> > <attr1></attr1> > <attr2></attr2> > > <attrn></attrn> > </Data> > </Data Set> > </DataArea> > </metadata> > > I am only interested getting the list of "Data" objects. The issue is, > Data class has a attribute called "lang" which should be loaded from > the value of the "lang" in the "metadata" node. (I am planning to load > series of files where metadata lang can be changed based on the > locale) > > What are the possible approaches that I can use ?. Is this something > that can be done by using the commons Digester. (I have no problrm of > loading the list of "Data")
It certainly can be done using the Digester, though you might have to create a custom Rule class or two. I would suggest having a look at the ObjectParamRule class which can be used to pass an arbitrary object to a method on the top object on the digester object stack. Regards, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]