I'm sorry for bumping this old thread but I recently started working on this again and have come up with a new problem/question for everyone here.
I decided to go back and change the way the characters are stored. In the past they were plain-text, one line = one value with no descriptions. They are now XML. This is my first time working with XML (in any language) but I think the character file is working 100% because there's no repeating value.
I want to create the world file as XML too. However, I have a problem. Let's say the world file looks something like this:
And so on, and so forth. From what I understand, when I do a search of the XML file it's going to stop at the first match. So if I search for "description" it's going to come to 0001's, read that description and that's it. It'll stop even if I want 0002's, or any other's. Same with any of the other values.
<Description>A description of the first room</description>
<north exit>0002</north exit>
<south exit>0003</south exit>
<Description>A description of the second room</description>
<south exit>0001</south exit>
. . .
This is how I have it set up to return a value from the character file. The incoming String node is what value I'm looking for (strength, health, password, name, whatever).
public String getData(String node)
characterReader = new XmlTextReader(file);
characterReader.WhitespaceHandling = WhitespaceHandling.None;
characterReader.Namespaces = false;
String data = "";
if (characterReader.NodeType == XmlNodeType.Element)
data = characterReader.ReadString();
// Finally, return with the data we were after.
So, does anyone know how to overcome the problem I'm going to face designing the world file in XML?