Writing to file/refresh problem/websphere

S

SashaNYC

I've looked all over and haven't seemed to find anything relating to my
problem:

Basically, I'm running a J2EE app on tomcat (developing in
websphere/server) and am creating an editor that accesses/updates an
xml file, all using Xerces.

First, I'm importing the xml from the file into a Document object,
delete a node, and print its contents: which all works.

But then, in order to update that file, I do this:

XMLSerializer xmlSer;
OutputFormat out;

out = new OutputFormat(doc);
out.setIndenting(true);

xmlSer = new XMLSerializer(new FileOutputStream(new File(xmlFile)),
out);
xmlSer.serialize(doc);

THIS WORKS--BUT....Only after I log out of the j2ee app and close out
IE6.

I've already tried doing instead so that I know i'm flushing to and
closing the file, but same thing happens. And it happens in both
Tomcat and Websphere Server:

FileOutputStream file = new FileOutputStream(xmlFile);
OutputStreamWriter out = new OutputStreamWriter(file, "UTF-8");

Transformer serializer =
TransformerFactory.newInstance().newTransformer();
serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");

// write to file
serializer.transform(new DOMSource(doc.getDocumentElement()), new
StreamResult(file));
file.flush();
file.close();


Any ideas why/how I can fix this?
 
S

SashaNYC

I forgot to mention--I'm transforming that XML file with an XSL so I
should see the updated results immediately, but I don't.

Thanks,

Alex
 
S

SashaNYC

Sorry all...everything worked right.


False alarm--I'm still a bit new at Struts (especially the way my
company's app is written...).

Everything works fine now
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top