xml in servlet

Hi

I have used DOM to read XML node values and DOM's Transformer class to save changed xml node values back to the xml file.

File f =new File("C:\\test.xml");

DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();

DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();

Document doc = docBuilder.parse(f);

I have changed the value of a node using setData method of Text.

Then saved the XML file again:

Source source =new DOMSource(doc);

Result res =new StreamResult(f);

Transformer x = TransformerFactory.newInstance().newTransformer();

x.transform(source,res);

It works fine.

But when I have a web based application, I put this code in a servlet and the xml file in WEB INF, it reads it and changes the node value but does not save the file when I use Transformer.

Does it not work for web based applications. Is there any other way out.

[1106 byte] By [PremMa] at [2007-10-3 9:47:03]
# 1
what is the path you give to the File constructor in your servlet?
alban.maillerea at 2007-7-15 5:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
If the OP can read and modify but cant save, sounds more like a security problem
LRMKa at 2007-7-15 5:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...