This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi I have to create a simple digester class .I tried the following example given on Apache site. Foo.java package mypackage; public class Foo { public void addBar(Bar bar); public Bar findBar(int id); public Iterator getBars(); public String getName(); public void setName(String name); } Bar.java package mypackage; public class Bar { public int getId(); public void setId(int id); public String getTitle(); public void setTitle(String title); } and you wish to use Digester to parse the following XML document: <foo name="The Parent"> <bar id="123" title="The First Child"/> <bar id="456" title="The Second Child"/> </foo> A simple approach will be to use the following Digester in the following way to set up the parsing rules, and then process an input file containing this document:
Digester digester = new Digester(); digester.setValidating(false); digester.addObjectCreate("foo", "mypackage.Foo"); digester.addSetProperties("foo"); digester.addObjectCreate("foo/bar", "mypackage.Bar"); digester.addSetProperties("foo/bar"); digester.addSetNext("foo/bar", "addBar", "mypackage.Bar"); Foo foo = (Foo) digester.parse(); This was working for me. Now I want to create a digester class which can read tags from xml file. But I don't want to give the matching patterns like this digester.addObjectCreate("foo", "mypackage.Foo");I want to read all the custom tags in xml in generakized manner.Can anybody give me a solution to this?