all groups > dotnet xml > june 2005 >
You're in the

dotnet xml

group:

What am I doing wrong part 2?


What am I doing wrong part 2? steve bull
6/17/2005 2:26:59 PM
dotnet xml:

I thought I had figured it out. But, I am only half way there.

Now I have the following code snippet to read the colorRange attributes for the colorRangeSwatch in the xml file listed
below.

string expr = "/swatches[colorRangeSwatch='All Red Colors']/colorRangeSwatch/colorRange";
XmlElement crsElement = (XmlElement)m_colorRangeSwatchDoc.SelectSingleNode(expr);
bool fr = bool.Parse(crsElement.GetAttribute("fixed").ToString());


The element returned is always the 1st, All Blue Colors, why doesn't the expression filter on the colorRangeSwatch
value?

Any ideas would be welcome.

Thanks,

Steve


The xml file which I am trying to read from :

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<swatches id="CustomColorRangeSwatches">
<colorRangeSwatch>All Blue Colors
<colorRange fixed="True"
red="0" green="0" blue="193"
redMin="0" redMax="0"
greenMin="0" greenMax="0"
blueMin="0" blueMax="255" />
</colorRangeSwatch>
<colorRangeSwatch>All Red Colors
<colorRange fixed="True"
red="183" green="0" blue="0"
redMin="0" redMax="255"
greenMin="0" greenMax="0"
blueMin="0" blueMax="0" />
</colorRangeSwatch>
</swatches>
Re: What am I doing wrong part 2? Robbe Morris [C# MVP]
6/17/2005 9:40:02 PM
Take a look at these xpath samples:

http://www.eggheadcafe.com/articles/20030627d.asp

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp



[quoted text, click to view]

Re: What am I doing wrong part 2? Dimitre Novatchev
6/18/2005 12:00:00 AM
What you're doing incorrectly, in addition to the problems with XPath, is
crossposting!

Please, stop this. Do not waste the time of your readers and do not confuse
them.



[quoted text, click to view]

AddThis Social Bookmark Button