I am a newbie to Java programming and trying to do an XML read and updation.
I was able to write a program in Java that will create the following XML file. There will be multiple staff in a XML file and the id's are unique. This example has 2 staff items.
<?xml version="1.0"?> <company> <staff id="1001"> <firstname>yong</firstname> <lastname>mook kim</lastname> <nickname>mkyong</nickname> <salary>100000</salary> </staff> <staff id="2001"> <firstname>low</firstname> <lastname>yin fong</lastname> <nickname>fong fong</nickname> <salary>200000</salary> </staff> </company> What i want to do is,
Step - 1: Read XML - based on ID provided by user, find the corresponding staff element and read it's salary.
Step-2: Update XML - Change the salary item for the corresponding staff and save the file.
What am looking for is an efficient way of doing this!
No comments:
Post a Comment