The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Eugene Neymark on February 23, 2001 at 12:50 PM

I found it easier to use Jdom and it worked fine.
Will try renaming the file and saving it under that name - i do it anyway for 'undo'.

> > Hi!
> > I'm trying to edit an xml file using java's dom parser.
> > Well.. the setNodeValue(String) does set it but it doesn't seem to affect the actual xml file. replacing a child doesn't cut it either ;( I would hate to manualy recreate the file using stringbuffer or something..

> > How do I save my changes to XML file?
> > Is there a way ? I heard about java-xml editors, but I would rather do it myself since it's not a large scale thing.

> > Any advice is greatly appriciated!
> > Thanks!

> The last XML project I worked on we had a similar problem. To overcome it, we simply renamed the XML file on disk, and recreated the original from the DOM, using the XmlDocument.write method.

> Hope that helps...

> Eoin


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us