-3

I've got a requirement to take an XML file and replace any existing value with one I generate from user input. Needs to only replace the existing value in the document.

I was looking at the simplest library SAX (https://docs.oracle.com/javase/tutorial/jaxp/sax/index.html) that is now in the standard JAVA JDK, but since this is an old project I was wondering if I should use something else like XMLT (https://docs.oracle.com/javase/tutorial/jaxp/xslt/transformingXML.html).

Can someone please advise the best (easiest) approach for this simple case?

SystemsInCode
  • 629
  • 7
  • 19
  • This is the best similar question which I found after posting: http://stackoverflow.com/questions/373833/best-xml-parser-for-java?rq=1 – SystemsInCode May 17 '16 at 13:47

1 Answers1

0

The fact that it's old does not change that it's XML. Use the library best suited to your needs. The standard SAX parser should be fine.

Also, if it's just a matter of replacing text content, why can't you just so a simple textual replace?

Somaiah Kumbera
  • 7,063
  • 4
  • 43
  • 44
  • 1
    Yes I guess it's a bit of learning exercise for when I need to do something more complex. Linked issue has lots of info (reading the SO duplicate guidelines it said not to bother closing the issue so Ieft it open). Ta. – SystemsInCode May 18 '16 at 10:23