DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; List nodeNameList = null; try { db = dbf.newDocumentBuilder(); Document doc = db.parse(societyXMLFile); NodeList list = doc.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if (node.getNodeName().equalsIgnoreCase("society") || node.getNodeName().equalsIgnoreCase("host")) { nodeNameList = getNodeNameList(node.getChildNodes()); } } } catch (ParserConfigurationException e1) { MessageDialog.openError(getShell(), "ERROR", e1.getMessage()); } catch (SAXException e) { MessageDialog.openError(getShell(), "ERROR", e.getMessage()); } catch (IOException e) { MessageDialog.openError(getShell(), "ERROR", e.getMessage());
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; List nodeNameList = null; try { db = dbf.newDocumentBuilder(); Document doc = db.parse(societyXMLFile); NodeList list = doc.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); String nodeName = node.getNodeName(); if (nodeName.equalsIgnoreCase("society") || nodeName.equalsIgnoreCase("host")) { nodeNameList = getNodeNameList(node.getChildNodes()); } else if (nodeName.equalsIgnoreCase("node")) { if (nodeNameList == null) { nodeNameList = new ArrayList(); } NamedNodeMap nnMap = node.getAttributes(); Node nameNode = nnMap.getNamedItem("name"); nodeNameList.add(nameNode.getNodeValue());
    protected List getNodeNameList(File societyXMLFile) {        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();        DocumentBuilder db;        List nodeNameList = null;        try {            db = dbf.newDocumentBuilder();            Document doc = db.parse(societyXMLFile);            NodeList list = doc.getChildNodes();            for (int i = 0; i < list.getLength(); i++) {                Node node = list.item(i);                if (node.getNodeName().equalsIgnoreCase("society") || node.getNodeName().equalsIgnoreCase("host")) {                    nodeNameList = getNodeNameList(node.getChildNodes());                }             }        } catch (ParserConfigurationException e1) {            MessageDialog.openError(getShell(), "ERROR", e1.getMessage());        } catch (SAXException e) {            MessageDialog.openError(getShell(), "ERROR", e.getMessage());        } catch (IOException e) {            MessageDialog.openError(getShell(), "ERROR", e.getMessage());        }        return nodeNameList;    }