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.Tex t)
Console.WriteLi ne (r.Value);
}
r.Close();
Here's my XML file:
<?xml version="1.0"?>
<ConfigurationS ettings>
<System SystemID="GLOBA L">
<CLEAR>Clear</CLEAR>
</System>
<System SystemID="AVIS" >
<AV1>AV1</AV1>
<AV2>AV2</AV2>
</System>
<System SystemID="BOATI NG">
<BB>BB</BB>
<BB2>BB2</BB2>
</System>
</ConfigurationSe ttings> 1 7931
Something like,
static void Main(string[] args)
{
XmlDocument doc=new XmlDocument();
doc.Load("c:/x.xml");
foreach ( XmlNode n in doc.SelectNodes ("*/*") )
{
Console.WriteLi ne("attribute;{ 0}", n.Attributes[0].InnerText);
Console.WriteLi ne("node;{0}", n.FirstChild.In nerText);
}
Console.Read();
}
XmlDocument is convenient. At the cost of performance/memory.
"Brian" <br*********@ky .gov> wrote in message
news:63******** *************** ***@posting.goo gle.com... 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.Tex t) Console.WriteLi ne (r.Value); } r.Close();
Here's my XML file:
<?xml version="1.0"?> <ConfigurationS ettings>
<System SystemID="GLOBA L"> <CLEAR>Clear</CLEAR> </System>
<System SystemID="AVIS" > <AV1>AV1</AV1> <AV2>AV2</AV2> </System>
<System SystemID="BOATI NG"> <BB>BB</BB> <BB2>BB2</BB2> </System> </ConfigurationSe ttings> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: forums_mp |
last post by:
I've got an STL class (see below) with two functions to store and
retrieve data - msg structs.
The "Store" function when called will copy the received message
(depending on which message) into the appropriate array. For instance
if I receive a RCVD_MSG1, I'll copy into msg1 . Upon receipt of
the next RCVD_MSG1. I'll copy into msg1 .
The Retrieve function when called should retrieve the latest copy.
ie. msg1 or msg1 .
|
by: Senthil Kannan |
last post by:
Hi all,
Currently i have a FORM_BASED Authentication of tomcat5.0 to
store and retrieve passwords in my homepage.Now when i try to Store my
password in a encrypted form i am having some problems,i am listing
the problems here.do help me to fix this.
when a new user signup to my homepage his datas are to be stored in
database.while storing this i need to store the password in encrypted
manner,when i insert it manually in comman line it...
|
by: thejackofall |
last post by:
Hi.
I am having a problem doing a simple sorting. Would someone be cool enough
to take a look and advise? It doesn't sort.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
using System;
using System.Collections;
using System.ComponentModel;
|
by: Kenny ODell |
last post by:
I am struggling a bit with XML, even as I wade through endless help files and
several books. I thought it would be useful to toss my particular needs to
the group to see what you think is the best approach.
I have a form that is able to read/write from an embedded device with one of
several serial protocols. Through this interchange, I can read or write lots
of different settings in the target. What I want to do now is save the...
|
by: Roy Gourgi |
last post by:
Hi,
I am used to working in Visual FoxPro and I would like to be able to create
a database and store and retrieve information from it. What is the simplest
way to do it and what should I be using as there are many choices to choose
from.
My database will contain a lot of records.
TIA
| |
by: Rudy |
last post by:
Hello all!
I am amazed how many posts I have read to store an image in SQL, and just as
many against it. So I learned how to store an image in a SQL db and retrieve
the image. A little tricky, but not too bad. But then I thought I wanted to
try the other way, by putting the file location in SQL and storing the actual
image in another directory.
I plan to have many images on my web application, up to as many as 5000.
Not to mention the...
|
by: serge calderara |
last post by:
Dear all,
I need to build a web application which will contains articles (long or short)
I was wondering on what is the correct way to retrive those article on web
page.
In orther words, when there is such information to be displayed are they
coming from imported files, database ?
Where and how this type of information is stored ?
What is the way to retrieve such information in order to display it in page ?
|
by: Solution Seeker |
last post by:
I want to Store the String value with Single Quotes in the Field of
Database where if i try to Store the String value with Single Quotes
(as it is) then it is throwing the error as SQL String Truncated.
so we need a solution to store and retrieve user Entered value along
with single quotes into the Database.
i am using the String variable to frame the Qry(that is then passed
to Database for execution) which is as follows
|
by: laptopia |
last post by:
I need to build, very quickly, implement a form that will add to a
database two text fields and store store an image associated with this
record.
All my experience with this is from ASP and ASPX, but I'm limited to
an PHP server and MySql. I should rephrase that because I don't thinks
its appropriate to use the word 'limited' when referring to PHP. I'm
starting to like this language.
I've seen tutorials on how to write my own class...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |