Hello.
I want to store some system settings in XML, but I am new to it. So
far, I am able to retrieve the attributes, but not the elements they
belong to (I hope my terminology is right). For example, I can
retrieve "Clear", "AV1", "AV2", "BB", and "BB2" from the XML file
below using this code, but I have no idea if they belong to the
"GLOBAL", "AVIS", or "BOATING" elements. Can anyone tell me how to
retrieve the element name, and while I'm at it, connect the dots? I'm
open to different code, in case I'm doing it all wrong.
Thanks in advance for any help.
-Brian
Here's my code:
XmlTextReader r = new XmlTextReader ("speedbar.xml");
while (r.Read()) {
if (r.NodeType == XmlNodeType.Text)
Console.WriteLine (r.Value);
}
r.Close();
Here's my XML file:
<?xml version="1.0"?>
<ConfigurationSettings>
<System SystemID="GLOBAL">
<CLEAR>Clear</CLEAR>
</System>
<System SystemID="AVIS">
<AV1>AV1</AV1>
<AV2>AV2</AV2>
</System>
<System SystemID="BOATING">
<BB>BB</BB>
<BB2>BB2</BB2>
</System>
</ConfigurationSettings>