Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Search and Replace XML TAG using JAVA

843834May 12 2010 — edited May 12 2010
Hi All,

I have an XML file, say RESULT.XML Which has about 30000 Lines (yes Thirty Thousand ). For some reason i need to replace an existing tag with a different tag(not the value inside the tag, But the tag itself) . I am facing a challenge. I will explain it as below.

I have a csv file which has 2 values as given below
<VALUE A> , <VALUE B>

where <VALUE A> is an existing node in the RESULT.XML and <VALUE B> is the node that should replace <VALUE A> in the RESULT.XML

i have 500 such entries in the file.

Now i need to write a program to read the csv file, Search <VALUE A> in the RESULT.XML and Replace it with <VALUE B> of the csv file.

please let me know how do i start with this.
I really want to fix this issue.

Existing Node = <Product ID="role (contact) 3" UserTypeID="Product Number">_

To be changed to = <Product ID= role (contact)3" UserTypeID="Product Number">_


please reply if you need any further information

Thanks in Advance

Manzoor
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 9 2010
Added on May 12 2010
7 comments
1,278 views