Beispiel #1
0
  public static void main(String args[]) {
    try {
      Element root = XmlUtil.loadDocument("/home/tmax/huation/WEB-INF/config/webpages.xml");
      NodeList nList = root.getElementsByTagName("webpage");
      for (int i = 0; i < nList.getLength(); i++) {
        org.w3c.dom.Node node = nList.item(i);
        if (node != null) {
          String name = XmlUtil.getSubTagValue(node, "name");
          String jsp = XmlUtil.getSubTagValue(node, "jsp");
          String s = XmlUtil.getSubTagValue(node, "description");
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
      System.out.println(e);
    }
  }
Beispiel #2
0
  private void load(String file_path) {
    try {
      Element root = XmlUtil.loadDocument(file_path);
      NodeList nList = root.getElementsByTagName("webpage");
      for (int i = 0; i < nList.getLength(); i++) {
        org.w3c.dom.Node node = nList.item(i);
        if (node != null) {
          String name = XmlUtil.getSubTagValue(node, "name");
          String jsp = XmlUtil.getSubTagValue(node, "jsp");
          String desc = XmlUtil.getSubTagValue(node, "description");
          String pages[] = new String[3];
          pages[0] = name;
          pages[1] = jsp;
          pages[2] = desc;
          ht.put(name, pages);
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }