Skip to Content
author's profile photo Former Member
Former Member

how to edit the existing data in the XML file from java programming.

Hi all

i am able to create XML file with the sample data as below from java programming.

i need sample code on how to edit the existing data in the XML file?

for example

<?xml version="1.0"?>

<mydata>

<data1>

<key1>467</key1>

<name1>Paul</name1>

<id1>123</id1>

</data1>

<data2>

<key2>467</key2>

<name2>Paul</name2>

<id2>123</id2>

</data2>

</mydata>

i am able to insert the data in the XML.

now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code

Regards

Sunil

[points will be always rewardable]

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2008 at 05:35 AM

    Hi,

    DOM, SAX, XSLT and many more are their to work with your scenario...

    Following link will shed some light

    http://www.developer.com/xml/article.php/10929_2108031_2

    http://www.w3schools.com/

    Regards

    Ayyapparaj

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 16, 2009 at 10:09 AM

    hi

    u need a parser or validate the xml file for to read the xml file from java coding u need for this

    xml4j.jar u can download this file from here

    http://www.alphaworks.ibm.com/tech/xml4j

    or we can use the SAX(simple API for XML)

    some sample applications for this

    http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html

    http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html

    http://www.xml-training-guide.com/e-xml44.html

    let me know u need any other info

    bvr

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.