so i got my xml changing program to work finally but i had to scrap part of it.
now i would like some guidence if any one has the time.
i got this program to find a specific tag in an xml file and change the information between the tag---
<me>cat</me>--- to ---<me>woot</me>
but with xml there can be multiple tags named <me>,for example. in my old program i also had it search for the current information and tag so i always had the right tag set then it changed the old info to the new user input.
i need help changeing the code to search for the right "tag set" and a way to include spaces in the new information so i can output a line of text and not just one word.
I don't understand the question. Here's a little rewrite of your program. I removed the latter loop as it didn't seem to be doing anything useful (and has an out-of-bound access).
the loop was for removing any excess char at the end of the file so that it will run. i kept getting extra char's at the end of the file.
<? xml version="1.0" ?>
<kyle>
<me>woot</me>
<me>what</me>
<me>were</me>
</kyle>
i needed to find a way to search for the '<me>' ? '</me>' so i can change its info and not the the others.
by the way what does this do?
while(myfile.get(c)) file.push_back(c);
So before replacing the substring found between the start and end tags, you want to compare it to the given old value. If it is not equal, you must loop back and find the next tag match, which means you must start after this one.
The while loop you refer to reads myfile char-by-char until EOF, appending each char read to the string called file.
thanks for explaining the loop hammurabi
and what you said in your first paragraph is correct but to add on to it, when it does find the correct information then it switchs out the old with the new.