KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > geinuke > util > BlockConfigParser


1
2  /*
3  -- GeiNuke --
4 Copyright (c) 2005 by Roberto Sidoti [geinuke@users.sourceforge.net]
5  http://www.hostingjava.it/-geinuke/
6
7 This file is part of GeiNuke.
8
9     GeiNuke is free software; you can redistribute it and/or modify
10     it under the terms of the GNU General Public License as published by
11     the Free Software Foundation; either version 2 of the License, or
12     (at your option) any later version.
13
14     GeiNuke is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17     GNU General Public License for more details.
18
19     You should have received a copy of the GNU General Public License
20     along with GeiNuke; if not, write to the Free Software
21     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */

23 package com.geinuke.util;
24
25 import org.w3c.dom.Element JavaDoc;
26 import org.w3c.dom.NodeList JavaDoc;
27
28 import com.geinuke.block.BlockWrapper;
29 import com.geinuke.common.BlockWidgetI;
30 import com.magic.util.xml.DOMUtil;
31 import com.magic.util.xml.XMLParser;
32
33
34 public class BlockConfigParser extends XMLParser {
35
36     
37     public Object JavaDoc parseElement(Element JavaDoc element) throws Exception JavaDoc {
38         BlockWrapper bloW=null;
39         Element JavaDoc el=null,
40                 elem=null;
41         NodeList JavaDoc nodes = null;
42         bloW=new BlockWrapper();
43         
44         //el=DOMUtil.getFirstElement(element,"module-config");
45
el=element;
46         String JavaDoc name=DOMUtil.getSimpleElementText(el,"name");
47         String JavaDoc des=DOMUtil.getSimpleElementText(el,"description");
48         bloW.setDesc(des);
49         bloW.setName(name);
50         
51         String JavaDoc clazz=DOMUtil.getSimpleElementText(el,"block-class");
52         BlockWidgetI o=null;
53         
54         //o=(BlockWidgetI)Class.forName(clazz).newInstance();
55
bloW.setBlockWidget(clazz);
56         
57         return bloW;
58     }
59
60 }
61
Popular Tags