Hi all, I am trying to load a set of beans using the Digester. One of the beans (Menu) will contain beans of the same type within. The basic layout of a page follows with what I think is the correct way of dragging in recursive tags (IE SubMenu is of type Menu). Can anyone verify if this is even in the right ball park?
Cheers Simon. PS I can't run it yet cause I'm only part way through workig out how to extract it all afterwards. [File sample] <WebPage> <Project> <Title/> <Version/> <Date/> </Project> <Menu> <Name/> <SubMenu> <Name/> <SubMenu/> <SubMenu/> </SubMenu> </Menu> <Frame/> </WebPage> [Code] public static ActionForm createWebPageForm(String webPageResourcePath) { //Get the resource doc by webPageResourcePath InputStream xmlStream = this.getClass().getResourceAsStream(webPageResourcePath); //Load FrontForm bean from the sitepage.xml config file. Digester digester = new Digester(); digester.setValidating(false); digester.setRules(new ExtendedBaseRules()); //Load digester with rules digester.addObjectCreate("WebPage", WebPage.class); digester.addObjectCreate("WebPage/Project", Project.class); digester.addBeanPropertySetter("WebPage/Project/Title", "Title"); digester.addBeanPropertySetter("WebPage/Project/Image", "Image"); digester.addBeanPropertySetter("WebPage/Project/Icon", "Icon"); digester.addBeanPropertySetter("WebPage/Project/Version", "Vesrion"); digester.addBeanPropertySetter("WebPage/Project/Date", "Date"); digester.addBeanPropertySetter("WebPage/Project/Home", "Home"); digester.addBeanPropertySetter("WebPage/Project/Address", "Address"); digester.addSetNext("WebPage/Project", "addProject"); digester.addObjectCreate("WebPage/Menu", Meun.class); digester.addBeanPropertySetter("WebPage/Meunu/*/Name", "Name"); digester.addBeanPropertySetter("WebPage/Menu/*/MenuItem", "MenuItem"); digester.addBeanPropertySetter("WebPage/Menu/*/MenuReference", "MenuReference"); digester.addObjectCreate("WebPage/Menu/*/SubMenu", "SubMenu", Menu.class); digester.addBeanPropertySetter("WebPage/Menu/*/SubMenu/Name", "Name"); digester.addBeanPropertySetter("WebPage/Menu/*/SubMenu/MenuItem", "MenuItem"); digester.addBeanPropertySetter("WebPage/Menu/*/SubMenu/MenuReference", "MenuReference"); digester.addSetNext("WebPage/Menu/*/SubMenu", "addSubMenu"); digester.addSetNext("WebPage/Menu", "addMenu"); digester.addObjectCreate("WebPage/Frame", Frame.class); digester.addSetNext("WebPage/Frame", "addFrame"); //Create the form from file return (WebPage)digester.parse(xmlStream); } Institut fuer Prozessdatenverarbeitung und Elektronik, Forschungszentrum Karlsruhe GmbH, Postfach 3640, D-76021 Karlsruhe, Germany. Tel: (+49)/7247 82-4042 E-mail : [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>