[jdom-interest] (no subject)

rgulati at cya.com rgulati at cya.com
Wed Jul 11 14:12:28 PDT 2001

    i have a problem using Jdom while reading form a file and delete a node and
then write to file again. it's not deleting the node. while Individually bith
method workd fine. If i am writing and then deleting works fine. if reading then
writing does not work.

this is write Method.
    XMLOutputter output = new  XMLOutputter(" ", true);
    FileWriter writer = new FileWriter(fileName);
    output.output(doc, writer);
This is read Method.
    this.doc = null;
    FileInputStream fis = new FileInputStream(fileName);
    SAXBuilder builder = new SAXBuilder();
    doc = builder.build(fis);
This is delete Method.
      Element root = doc.getRootElement();
      List list = root.getChildren(nodeDesc.nodeName());
      int index = -1;
      for (int i = 0; i < list.size(); i++) {
        Element temp = (Element)list.get(i);
        String attValue =
        if (attValue.equals(nodeDesc.checkAttributeValue())) {
          index = i;
      if (index!= -1) {
        Element nodeLvlOne = (Element)list.get(index);
may be if you could help me in this. Individual everything is working But bot
read method Then delete and then Write method thar doesnot work.
Renu Gulati

More information about the jdom-interest mailing list