Results 1 to 5 of 5
  1. #1
    qamargrt is offline Member
    Join Date
    Jan 2012
    Posts
    3
    Rep Power
    0

    Default Updating XML file with same tag names

    I have this xml

    ------------------------------------

    <Results>-
    <Result id="1">-
    <hometeam>
    <Name>Dantooine Destroyers</Name>
    <score>23</score>
    </hometeam>
    <awayteam>
    <Name>Wayland Warriors</Name>
    <score>3</score>
    </awayteam>
    </Result>
    </Results>


    ------------------------------------

    I want to add the Result element including child nodes again in the same pattern in XML file but different result ID's as shown below.

    ===========================================
    <Results>-
    <Result id="1">-
    <hometeam>
    <Name>Dantooine Destroyers</Name>
    <score>23</score>
    </hometeam>
    <awayteam>
    <Name>Wayland Warriors</Name>
    <score>3</score>
    </awayteam>
    </Result>
    <Result id="2">-
    <hometeam>
    <Name>Dantooine Destroyers</Name>
    <score>23</score>
    </hometeam>
    <awayteam>
    <Name>Wayland Warriors</Name>
    <score>3</score>
    </awayteam>
    </Result>
    </Results>
    =====================================


    Any help would be appreciated..

    Thank you,,,,

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,755
    Rep Power
    19

    Default Re: Updating XML file with same tag names

    It all depends on what you want to do with it.
    That will define the parser to use, pretty much, or even whether to bother using a parser (since this could be done with simple file io).

  3. #3
    qamargrt is offline Member
    Join Date
    Jan 2012
    Posts
    3
    Rep Power
    0

    Default Re: Updating XML file with same tag names

    Hi Thanks for your reply. Actually the problem is I am using DOM parser and when I update the file it overwrites the data instead of adding so I was trying to find a way so instead of overwriting it add into it..

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,755
    Rep Power
    19

    Default Re: Updating XML file with same tag names

    How are you making the changes at the moment then?

  5. #5
    qamargrt is offline Member
    Join Date
    Jan 2012
    Posts
    3
    Rep Power
    0

    Default Re: Updating XML file with same tag names

    Its Done Thanks for your support. I parsed the xml file and then got its result element and after that I added new childs.

Similar Threads

  1. Replies: 2
    Last Post: 12-05-2011, 06:15 AM
  2. Reading In File Names
    By Vorsaykal in forum New To Java
    Replies: 2
    Last Post: 11-27-2011, 03:30 AM
  3. Replies: 8
    Last Post: 02-20-2009, 12:40 PM
  4. Adding file names(Help!!)
    By Gambit17 in forum New To Java
    Replies: 4
    Last Post: 11-09-2007, 07:26 AM
  5. building file and variable names from variables
    By madad2005 in forum New To Java
    Replies: 2
    Last Post: 07-18-2007, 04:47 PM

Posting Permissions

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