Angela Rizo

Greenhorn
+ Follow
since Dec 15, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Angela Rizo

But like I said, if i call the method evert time the user adds a new student, it creates a new xml file every time so the last file contains only the last student that was created.
Is there a way to make one method that will create the file, and another that will add elements to it?
Thank you for your help
Can you please explain how to make the for loop for adding elements to the xml file? Because i understand that even though the tag can be the same, every element has to have a different name.
So how do I create a new element name (for example firstname1, firstname2) every time a new student is created?
Thank you.

Yes, but I don't know the exact number of students I will need.
I need this for a gui, so the person who will use it can enter any number of students.
So when I call this method I don't want it to create a new xml file, but to add a new student to the existing one.

How can I write a method that only adds elements to the file, and doesn't recreate it?
I have a xml file that looks like this:

<list>
<student>
<firstname>"a"</firstname>
<lastname>"b"</lastname>
</student>
</list>

The code I used to create this xml file is:




How do I add another student without replacing the first one?