I am not sure how far my solution is going to solve u r problem. Just give a thought to my solution and let me know if it helps you.
since you want to pass an attribute value into your xml file, I suggest you to create your xml file in Jsp file.
For exmample,
String x = request.getParameter("address");
try{
FileOutputStream fout = new FileOutputStream(new File("address.xml"));
String xml = " <ADDRESS> " +
" <tag id=\"company\" value=\"" + x + "\" />" +
"</ADDRESS>" ;
bytes b[] = xml.getBytes();
fout.write(b);
}
catch(Exception e) {
System.out.println(e);
}
The first statement in try block will create address.xml file into which you can pass the value of 'x' as an attribute value of the node tag.
I feel it would be better approach if the size of xml is considerably small. If it is an external file, you may have to parse the file using either SAX or DOM parser, catch the attribute of the node tag and replace the value of the desired attribute.
waiting to hear from you, if you feel it a valid suggestion. My email is
pvvnath@yahoo.com