Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Having problem in modifying the value of node in xml

 
Rajesh k Jha
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to everyone,
Actually i am using XML as database to store value temporarily and later on it will be uploaded on the server and will be updated in the database, but currently i am having following problem.

1. I can save my data in the XML format in the local disk, but when i am editing some part node value, how can i override this value in the xml file.

I am attaching the source code of xml file.

<?xml version="1.0"?>
<VILLAGEINFORMATIONFORM>
<VIF1>
<stateCode>MDI=</stateCode>
<districtCode>MDE=</districtCode>
<blockCode>MDAwMg==</blockCode>
<villageCode>MDAwMTUxMDA=</villageCode>
<tot_no_hbt_village>Nzg3OA==</tot_no_hbt_village>
<no_hbt_prmrystg_school>ODc=</no_hbt_prmrystg_school>
<no_hbt_prmrystg_school_1km>OA==</no_hbt_prmrystg_school_1km>
<no_hbt_prmrystg_school_bnd1km>Nw==</no_hbt_prmrystg_school_bnd1km>
<no_hbt_uprprmrystg_school_within>ODc=</no_hbt_uprprmrystg_school_within>
<no_hbt_uprprmrystg_school_bnd3km>Nzg=</no_hbt_uprprmrystg_school_bnd3km>
<no_hbt_uprprmrystg_school_3km>OA==</no_hbt_uprprmrystg_school_3km>
<no_uncrg_school_prmryuprprmry_class>Nw==</no_uncrg_school_prmryuprprmry_class>
<enrlmnt_uncrg_prmry_stg>ODc=</enrlmnt_uncrg_prmry_stg>
<enrlmnt_uncrg_uprprmry_stg>OA==</enrlmnt_uncrg_uprprmry_stg>
<entered_by>ZGVvMzIwNDE=</entered_by>
<entered_datetime>Mon Sep 13 14:32:18 GMT+05:30 2010</entered_datetime>
<modified_by>ZGVvMzIwNDE=</modified_by>
<modified_datetime>Mon Sep 13 14:32:18 GMT+05:30 2010</modified_datetime>
</VIF1>
<VIF2>
<stateCode>001=</stateCode>
<districtCode>0003=</districtCode>
<blockCode>0001004==</blockCode>
<villageCode>2001=</villageCode>

</VIF2>
<VIF3>
<stateCode>001=</stateCode>
<districtCode>003=</districtCode>
<blockCode>00004==</blockCode>
<villageCode>0001001=</villageCode>
</VIF3>

If i made some changes in the VIF2 using edit form developed in SWING then how can i update it in the XML file.

Can someone please guide me on this, as this is very urgent and i am not getting any clue for this on Google.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can save my data in the XML format in the local disk,


Exactly how are you doing that? Are you building a Document in memory or just writing text?

I recommend Harold's free online book for examples of this sort of thing.

Bill
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i made some changes in the VIF2 using edit form developed in SWING then how can i update it in the XML file.


The "edit" process should (1) read the file and (2) create a "new" file with the modification. Basically, the new file replaces the old file.
 
Rajesh k Jha
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello William and Jimmy,

Thanks so much for your attention, I got my problem solved, as I was able to replace the node in memory but not in file, In google i got one help that i want to share with all

and then at last when all setting of node is done in memory
use below code to write it in the file

This will help someone as a solution to someone else...
Thanks again...

This is how we can set the value of
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic