Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Writind Data to XML in XML Format

843785Sep 18 2008 — edited Sep 19 2008
Hi,
This is my First post in Sun Forums.
I m learning XML writing in Java.
I have searched on the Net but unable to find the proper XML writing Method using any API.
Please provide code for writing the XML in correct format with useful API.?
i m giving the Scenario of XML here:-

<?xml version="1.0" encoding="UTF-8"?>
<Data>
<Description>Description Addes</Description>
<Details>Details Added</Details>
</Data>

I want to Write this Data Using the Java using any API.

Also I want to append the Data while i m executing the XML for second time.

<?xml version="1.0" encoding="UTF-8"?>
<Data>
<Description>Description Addes</Description>
<Details>Details Added</Details>

</Data>
<Data>
<NewDescription>NewDescription Addes</NewDescription>
<NewDetails>NewDetails Added</NewDetails>

</Data>

I have also made 1 application using dom4j which write data to XML file but while i m appending the Data
for the Second time in the XML the same line repeatd <?xml version="1.0" encoding="UTF-8"?> in the XML.

So please guide me how to remove or delete this line while i m going for writing the XML again or Appending the Data Again..

Please provide some code or good Links or Solution for my Problem for writing the Simple XML format file and Appending the Data to the Same XML without including the <?xml version="1.0" encoding="UTF-8"?> this line
Again ?
?.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 17 2008
Added on Sep 18 2008
7 comments
235 views