Click here to Skip to main content
15,901,853 members
Home / Discussions / C#
   

C#

 
GeneralRe: View Images Advice Pin
Not Active10-Jul-06 6:46
mentorNot Active10-Jul-06 6:46 
GeneralRe: View Images Advice [modified] Pin
tadhg8810-Jul-06 7:19
tadhg8810-Jul-06 7:19 
QuestioncomboBox without change value Pin
TAREQ F ABUZUHRI10-Jul-06 5:00
TAREQ F ABUZUHRI10-Jul-06 5:00 
AnswerRe: comboBox without change value Pin
Dustin Metzgar10-Jul-06 5:11
Dustin Metzgar10-Jul-06 5:11 
AnswerRe: comboBox without change value Pin
Josh Smith10-Jul-06 5:12
Josh Smith10-Jul-06 5:12 
GeneralRe: comboBox without change value Pin
TAREQ F ABUZUHRI10-Jul-06 5:17
TAREQ F ABUZUHRI10-Jul-06 5:17 
GeneralRe: comboBox without change value Pin
TAREQ F ABUZUHRI10-Jul-06 5:21
TAREQ F ABUZUHRI10-Jul-06 5:21 
QuestionNotSupportedException was unhandled Pin
donkaiser10-Jul-06 4:59
donkaiser10-Jul-06 4:59 
QuestionMissing System.Drawing.Point Pin
Andy H10-Jul-06 4:56
Andy H10-Jul-06 4:56 
AnswerRe: Missing System.Drawing.Point Pin
Andy H10-Jul-06 5:00
Andy H10-Jul-06 5:00 
QuestionUser objects limit in XP Pin
atuldeore10-Jul-06 4:26
atuldeore10-Jul-06 4:26 
AnswerRe: User objects limit in XP Pin
S. Senthil Kumar10-Jul-06 6:18
S. Senthil Kumar10-Jul-06 6:18 
QuestionSuppress Paint Event Pin
Andrei Ungureanu10-Jul-06 3:49
Andrei Ungureanu10-Jul-06 3:49 
AnswerRe: Suppress Paint Event Pin
LongRange.Shooter10-Jul-06 4:03
LongRange.Shooter10-Jul-06 4:03 
AnswerRe: Suppress Paint Event Pin
Josh Smith10-Jul-06 4:38
Josh Smith10-Jul-06 4:38 
Questiongetting XML Attribute doesn't work [modified] Pin
Schimaera10-Jul-06 3:34
Schimaera10-Jul-06 3:34 
Hi @all,

i have a big problem. I want to read an attribute from the following XML-File:
-------------
<main>

<equations>
<rule name = "equation1"
calc = "D=A+B+3*C"></rule>

<rule name = "equation2"
calc = "E=A*B+C*D"></rule>

<rule name = "equation3"
calc = "C=B/A"></rule>
</equations>



<values>
<rule name = "equation1">
<Source obj = "12.3"
field = "A"></Source>

<Source obj = "1"
field = "B"></Source>

<Source obj = "23"
field = "C"></Source>
</rule>


<rule name = "equation2">
<Source obj = "1"
field = "A"></Source>

<Source obj = "1"
field = "B"></Source>

<Source obj = "7"
field = "C"></Source>

<Source obj = "6"
field = "D"></Source>
</rule>


<rule name = "equation3">
<Source obj = "12.3"
field = "A"></Source>

<Source obj = "1"
field = "B"></Source>
</rule>
</values>
</main>
---------------

So tried to get the "equation1" from the first rule segment in value with the following code:

-----------------
XPathDocument document = new XPathDocument("test.xml");
XPathNavigator navigator = document.CreateNavigator();

XPathNodeIterator name = navigator.Select("main/values/rule[0]");

string i = name.Current.GetAttribute("name", string.empty);
-----------------

or:
-----------------
XPathNodeIterator name =navigator.Select("main/values/rule[0]/@name");

if (name.MoveNext())
{
string i = name.Current.Value;
}
-----------------


Nothing works! I'am getting an empty string (""). If I debug I see name->Current->HasAttribute = false.

I dont know what I can do. Can you help me please?

Thank you very much!

(sorry for my english, my native language is not english Wink | ;-)

-- modified at 9:39 Monday 10th July, 2006
AnswerRe: getting XML Attribute doesn't work Pin
Andrei Ungureanu10-Jul-06 3:46
Andrei Ungureanu10-Jul-06 3:46 
AnswerRe: getting XML Attribute doesn't work Pin
stancrm10-Jul-06 3:49
stancrm10-Jul-06 3:49 
GeneralRe: getting XML Attribute doesn't work Pin
Schimaera10-Jul-06 4:24
Schimaera10-Jul-06 4:24 
Questionadd control to listBox Pin
TAREQ F ABUZUHRI10-Jul-06 3:14
TAREQ F ABUZUHRI10-Jul-06 3:14 
AnswerRe: add control to listBox Pin
LongRange.Shooter10-Jul-06 4:08
LongRange.Shooter10-Jul-06 4:08 
GeneralRe: add control to listBox Pin
Josh Smith10-Jul-06 4:40
Josh Smith10-Jul-06 4:40 
AnswerRe: add control to listBox Pin
Andrew Lygin10-Jul-06 10:07
Andrew Lygin10-Jul-06 10:07 
Questionms access problem :( help please ... Pin
cmpeng3410-Jul-06 2:38
cmpeng3410-Jul-06 2:38 
AnswerRe: ms access problem :( help please ... Pin
LongRange.Shooter10-Jul-06 4:13
LongRange.Shooter10-Jul-06 4:13 

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.