HI I have a xml file shown below <?xml version="1.0" standalone="no"?> <destination> <file name="check.xml"> <tag type="line">data to be replaced as line1</tag> <junk_tag>xyz</junk_tag> <tag type="line">data to be replaced as line1</tag> <tag type="line">data to be replaced as line3</tag> <tag type="img>c:\....</tag>
I need to read the file and check for <tag type="line"> and replace the value between <tag type="line"> </tag> in the file. Also I need to store the value of the tag in a hash table with key value pair as for example [line1(key), data to be replaced as line1(value)] How do I do it? Thanks sreeni
Joined: Mar 07, 2002
Well, I do not think you need to parse the XML file at all. You can use regular expressions. J2SE 1.4 now has a regexp package that can handle regular expressions very well. Check it out!