Updating xml file with java

A

ahjiang

i have an xml file something like this

<ROOT LANGID="0" LANGPRIORITY="1">
<STRING id=" IMPORTANT !!! Please note it down for your
future reference\n">
<VALUE></VALUE>
<FILENAME
line="46">D:\views\rel8.1_1.0_final\Tally\include\sfntencstr.txt</FILENAME>
</STRING>
</ROOT>



i would like to search the xml file if id = "some input" and if found,
insert a value between the tags <VALUE></VALUE>

i understand jdk.1.5 provide the xpath api..

does anyone has sample of writing the values back to the xml file using
the api?


Appreciate any help
 
W

William Brogden

i have an xml file something like this

<ROOT LANGID="0" LANGPRIORITY="1">
<STRING id=" IMPORTANT !!! Please note it down for your
future reference\n">
<VALUE></VALUE>
<FILENAME
line="46">D:\views\rel8.1_1.0_final\Tally\include\sfntencstr.txt</FILENAME>
</STRING>
</ROOT>



i would like to search the xml file if id = "some input" and if found,
insert a value between the tags <VALUE></VALUE>

i understand jdk.1.5 provide the xpath api..

does anyone has sample of writing the values back to the xml file using
the api?


Appreciate any help

Go to the Sun Java Tutorial at
http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/index.html

pick the "XML and the Document Object Model" link for example code.

Bill
 

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,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top