1 18 19 package org.objectweb.jac.core.parsers.xml; 20 21 import java.util.Vector ; 22 import org.apache.log4j.Logger; 23 import org.w3c.dom.*; 24 25 public class ACElementInterpreter implements ElementInterpreter { 26 static Logger logger = Logger.getLogger("xml"); 27 28 public ACElementInterpreter() { 29 } 30 31 public Vector interpret(Element element, Class targetClass) throws Exception 32 { 33 NodeList childNodes = element.getChildNodes(); 34 int length = childNodes.getLength(); 35 Node childNode; 36 String tagName; 37 Vector methods = new Vector (); 38 MethodElementInterpreter meInterpreter = new MethodElementInterpreter(); 39 for (int i=0; i<length; i++) { 40 childNode = childNodes.item(i); 41 if ( childNode instanceof Element ) { 42 Element childElement = (Element)childNode; 43 tagName = childElement.getTagName().intern(); 44 if (tagName.equals("method")) { 45 methods.add(meInterpreter.interpret( childElement, targetClass )); 46 } else { 47 logger.error("Expecting <method> element, found <"+tagName+">"); 48 } 49 } 50 } 51 return methods; 52 } 53 } 54 | Popular Tags |