Error using XMLDataDocument.SelectSingleNode

  • Thread starter Thread starter Coco
  • Start date Start date
C

Coco

I want to select a single which has the mix attribute
value <= 40 and max attribute >= 40 node from the
following xml

<range>
<age min="21" max="30"></age>
<height min="1.2" max="1.6"></height>
<weight min="20" max="50"></weight>
</range>
<range>
<age min="31" max="40"></age>
<height min="1.3" max="1.7"></height>
<weight min="30" max="60"></weight>
</range>

i use the following code to do that but get error "The
expression passed to this method should result in a
NodeSet. "
XmlNode rangeNode = mapping.SelectSingleNode
("//Mapping/Age2HeightWeight/age[@min <= 40 and @max =>
40 " ]");
what is the problem?
 
You could try using SelectNodes (which returns a list of nodes) instead of
SelectSingleNode.
I want to select a single which has the mix attribute
value <= 40 and max attribute >= 40 node from the
following xml

<range>
<age min="21" max="30"></age>
<height min="1.2" max="1.6"></height>
<weight min="20" max="50"></weight>
</range>
<range>
<age min="31" max="40"></age>
<height min="1.3" max="1.7"></height>
<weight min="30" max="60"></weight>
</range>

i use the following code to do that but get error "The
expression passed to this method should result in a
NodeSet. "
XmlNode rangeNode = mapping.SelectSingleNode
("//Mapping/Age2HeightWeight/age[@min <= 40 and @max =>
40 " ]");
what is the problem?

Adrian Vinca [MSFT]
 
Back
Top