Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

need to update entry in XML file.

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I having an xml file with following entries.


from java i need to update the entry for <dontshowremove> to true.

I tried it in following way using Jdom


In this way value is getting updated on Element object only not in file i.e. when i open xml file it is displaying false only.

Please let me know, how i can modify the physical xml file entry and save that file.
so for the next time when i open an file i'll get the new entry.

Thanks
Sharad

[ November 06, 2008: Message edited by: Sharad Goluone ]
[ November 06, 2008: Message edited by: Sharad Goluone ]
 
Marshal
Posts: 26912
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a quick look through the documentation, to see if I could find something that would write a Document to a file. JDOM consists of about half a dozen packages. The one named org.jdom.output looked like it might have something to do with outputting things. And indeed it contained a class named XMLOutputter whose description is exactly what you want. The documentation is your friend.
 
Sharad Kharya
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul, Its implemented in following way:-




 
Sharad Kharya
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Please let me know, here"outputter.output(doc,buf);" will update file with only one updated entry or the whole doc i.e complete xml file will be regenerated from the scratch.
I am asking this due to performance related issues.

Thanks
Sharad
 
reply
    Bookmark Topic Watch Topic
  • New Topic