×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    18

    Red face XML writing and Appending the Problem

    Hi,

    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 ?
    ?.

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: XML writing and Appending the Problem

    Hi talk2mishal,

    I have not direct experience with dom4j but, to correctly write/append data to your existing XML, you could try first reading the current one, working on it with dom4j, and then rewriting the whole XML to your file.

    Hope it helps,
    Pit

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    18

    Red face Re: XML writing and Appending the Problem

    Thanking you for this valuable answer.

    If u have any code or ant link for that than please attach here in this message as i am stucked here ...

  4. #4
    Nokia Developer Expert
    Join Date
    Jun 2005
    Posts
    923

    Re: XML writing and Appending the Problem

    Dom4J is not related to Java ME.

    Please refer to this link: http://www.devx.com/Java/Article/29161

    I will close this thread. Please refraing from posting off-topic questions in the future.

    Daniel

Similar Threads

  1. weird problem when downloading file via HTTP.
    By Dattanand in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2008-06-21, 14:01
  2. problem ith reading & writing text-files
    By szallah in forum Symbian
    Replies: 2
    Last Post: 2008-05-26, 00:33
  3. Replies: 3
    Last Post: 2008-02-18, 11:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×