1 7 package com.bull.eclipse.jonas.utils.xml; 8 9 import java.io.File ; 10 import java.io.FileInputStream ; 11 import java.io.FileNotFoundException ; 12 import java.io.IOException ; 13 import java.util.Vector ; 14 15 import javax.xml.parsers.ParserConfigurationException ; 16 17 import org.w3c.dom.Document ; 18 import org.w3c.dom.Node ; 19 import org.w3c.dom.NodeList ; 20 import org.xml.sax.SAXException ; 21 22 28 public class TestXML { 29 30 public static void main(String [] args) { 31 File xmlFileEJB = new File ("H:/Projet/Middlegen/samples/build/ejb-meta/META-INF/ejb-jar.xml"); 32 FileXmlUtils.getAllNameAndPackageEJBEntity(xmlFileEJB); 33 34 35 45 46 } 47 48 private static Node getNodeInWebFile(Document webXmlFile) { 49 Node webNode = webXmlFile.getElementsByTagName("servlet-mapping").item(0); 52 if (webNode == null) 53 webNode = webXmlFile.getElementsByTagName("session-config").item(0); 54 if (webNode == null) 55 webNode = webXmlFile.getElementsByTagName("mime-mapping").item(0); 56 if (webNode == null) 57 webNode = webXmlFile.getElementsByTagName("welcome-file-list").item(0); 58 if (webNode == null) 59 webNode = webXmlFile.getElementsByTagName("error-page").item(0); 60 if (webNode == null) 61 webNode = webXmlFile.getElementsByTagName("taglib").item(0); 62 if (webNode == null) 63 webNode = webXmlFile.getElementsByTagName("resource-env-ref").item(0); 64 if (webNode == null) 65 webNode = webXmlFile.getElementsByTagName("resource-ref").item(0); 66 if (webNode == null) 67 webNode = webXmlFile.getElementsByTagName("security-constraint").item(0); 68 if (webNode == null) 69 webNode = webXmlFile.getElementsByTagName("login-config").item(0); 70 if (webNode == null) 71 webNode = webXmlFile.getElementsByTagName("security-role").item(0); 72 if (webNode == null) 73 webNode = webXmlFile.getElementsByTagName("env-entry").item(0); 74 if (webNode == null) 75 webNode = webXmlFile.getElementsByTagName("ejb-ref").item(0); 76 if (webNode == null) 77 webNode = webXmlFile.getElementsByTagName("ejb-local-ref").item(0); 78 if (webNode == null) 79 webNode = webXmlFile.getElementsByTagName("web-app").item(0); 80 81 return webNode; 82 } 83 } 84 | Popular Tags |