|
-
Oct 24th, 2003, 03:44 PM
#1
Thread Starter
Hyperactive Member
Trying to retrieve value from basic XML
I have an XML file with the following:
<AppSetting>
...
Nothing of Interest
...
</AppSetting>
<Customer>
...
<add key=”Bla” value=”South”/>
...
</Customer>
My goal is to check if the key “Bla” is equal to “South” from my code.
If I put the key “Bla” in my AppSetting section then the following would work:
ConfigurationSettings.AppSettings["Bla"] == “South”
However, how can I access the value when it is placed inside the Customer Section? There must be some simple statement that can be used but I am unable to find anything besides getting Customer Section as a dictionary and going threw the setting [not something I want to do, only want that one value].
Any clues [using C#]?
-
Oct 27th, 2003, 12:02 PM
#2
Frenzied Member
is this being declared in the web.config file? (if so, post the format of the file) or in some other xml document?
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Oct 27th, 2003, 12:38 PM
#3
Frenzied Member
you could just create a customers.xml file and read it
Code:
using System.Xml;
XmlTextReader reader = new XmlTextReader(Server.MapPath("customers.xml"));
while(reader.Read())
{
reader.MoveToContent();
if (reader.NodeType == XmlNodeType.Element)
Response.Write("<b><" + reader.Name + "></b><br>");
if (reader.NodeType == XmlNodeType.Text)
Response.Write(reader.Value + "<br>");
}
reader.Close();
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|