Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 11:37
Snowjim18-May-05 11:37 
GeneralRe: Simple XML problem Pin
Robert Rohde18-May-05 9:21
Robert Rohde18-May-05 9:21 
GeneralRe: Simple XML problem Pin
DavidNohejl18-May-05 10:22
DavidNohejl18-May-05 10:22 
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 11:34
Snowjim18-May-05 11:34 
GeneralRe: Simple XML problem Pin
leppie18-May-05 9:40
leppie18-May-05 9:40 
GeneralRe: Simple XML problem Pin
DavidNohejl18-May-05 10:28
DavidNohejl18-May-05 10:28 
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 11:26
Snowjim18-May-05 11:26 
GeneralRe: Simple XML problem Pin
DavidNohejl18-May-05 12:34
DavidNohejl18-May-05 12:34 
How come this works?? (I copied your snippet & XML file + changed MessageBox cuz it's VERY bad way how to debug loops!)
xTR.MoveToContent();

        while (xTR.Read())
        {
            if (xTR.NodeType == XmlNodeType.Element)
            {
                switch (xTR.Name)
                {
                    case "port":
                        Console.WriteLine("Port : " + xTR.ReadInnerXml());
                       break;
                    case "stopbits":
                        Console.WriteLine("StopBits : " + xTR.ReadInnerXml());
                        break;
                    case "parity":
                        Console.WriteLine("Parity : " + xTR.ReadInnerXml());
                        break;
                   ...

for this XML file:
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<port>0</port>
<stopbits>4</stopbits>
<parity>2</parity>
<boudrate>9</boudrate>
<databits>4</databits>
<addtimestamp>True</addtimestamp>
<savetofile>True</savetofile>
<sizeofwindow>MEDIUM</sizeofwindow>
<mounteddisplay>True</mounteddisplay>
</settings>

gives me output:
Port : 0
StopBits : 4
Parity : 2
BoudRate : 9
DataBits : 4
AddTimeStamp : True
SaveToFile : True
SizeOfWindow : MEDIUM
MountedDisplay : True
Press any key to continue
(console app in debug mode)

However I had to change strings in switch... (it's case sensitive)

I was wrong InnerText is property of XmlElement not of XmlReader Blush | :O .

David

Never forget: "Stay kul and happy" (I.A.)

David's thoughts / dnhsoftware.org / MyHTMLTidy
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 12:44
Snowjim18-May-05 12:44 
GeneralRe: Simple XML problem Pin
DavidNohejl18-May-05 13:26
DavidNohejl18-May-05 13:26 
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 13:31
Snowjim18-May-05 13:31 
GeneralReusing a local port when sending from a bound socket Pin
ghassett2218-May-05 7:28
ghassett2218-May-05 7:28 
QuestionC# 'static' variables on the web? Pin
LizardWiz18-May-05 7:05
LizardWiz18-May-05 7:05 
AnswerRe: C# 'static' variables on the web? Pin
S. Senthil Kumar18-May-05 7:24
S. Senthil Kumar18-May-05 7:24 
AnswerRe: C# 'static' variables on the web? Pin
S Sansanwal18-May-05 12:09
S Sansanwal18-May-05 12:09 
AnswerRe: C# 'static' variables on the web? Pin
Joshua Nussbaum18-May-05 14:21
Joshua Nussbaum18-May-05 14:21 
GeneralWebService DataSet Help Pin
Rougy18-May-05 5:29
Rougy18-May-05 5:29 
GeneralRe: WebService DataSet Help Pin
Robert Rohde18-May-05 8:40
Robert Rohde18-May-05 8:40 
GeneralRe: WebService DataSet Help Pin
Rougy19-May-05 4:10
Rougy19-May-05 4:10 
GeneralRe: WebService DataSet Help Pin
Rougy19-May-05 4:15
Rougy19-May-05 4:15 
GeneralRe: WebService DataSet Help Pin
Robert Rohde19-May-05 6:16
Robert Rohde19-May-05 6:16 
GeneralrichTextBox keyPress event problem Pin
pessen18-May-05 5:27
pessen18-May-05 5:27 
GeneralRe: richTextBox keyPress event problem Pin
S. Senthil Kumar18-May-05 5:42
S. Senthil Kumar18-May-05 5:42 
GeneralRe: richTextBox keyPress event problem Pin
pessen18-May-05 5:53
pessen18-May-05 5:53 
GeneralProblem in Opening connection in SQL Server Pin
Murtuza Husain Miyan Patel18-May-05 5:10
professionalMurtuza Husain Miyan Patel18-May-05 5:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.