Error using XMLDataDocument.SelectSingleNode

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Coco

    #1

    Error using XMLDataDocument.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.SelectS ingleNode
    ("//Mapping/Age2HeightWeigh t/age[@min <= 40 and @max =>
    40 " ]");
    what is the problem?
  • Adrian Vinca [MSFT]

    #2
    RE: Error using XMLDataDocument .SelectSingleNo de

    You could try using SelectNodes (which returns a list of nodes) instead of
    SelectSingleNod e.
    [color=blue]
    >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.SelectS ingleNode
    >("//Mapping/Age2HeightWeigh t/age[@min <= 40 and @max =>
    >40 " ]");
    >what is the problem?
    >[/color]

    Adrian Vinca [MSFT]
    --------------------------------------------------------------------
    This reply is provided AS IS, without warranty (express or implied).


    Comment

    Working...