Yes. The XPath expression included in your sample code looks for the very
first element in the document calles "riders", having a child element
"Position", having a child element named "Element", that has an attribute
named "Operation" with a value of "insert". If all of these conditions are
not met, then nothing will be matched... hence nothing is returned. Your
first element is now "UpdateRQ", so the XPath expression will not match
anything in your structure. Add the UpdateRQ element into your XPath
statement:
XmlNodeList nodeList =
xmlDocument.SelectNodes("/UpdateRQ/riders/Position/Element[@Operation =
'insert']")
--
Kirk Allen Evans
blogs.msdn.com/kaevans
-- This posting is provided "AS IS" with no warranties, and confers no
rights.
[quoted text, click to view] "cheryl hawes" <chawes7420@aol.com> wrote in message
news:%23r8QFRsNEHA.628@TK2MSFTNGP11.phx.gbl...
> XmlNodeList nodeList = xmlDocument.SelectNodes(
> "/riders/Position/Element[@Operation = 'insert']")
>
> Would the above nodeList change if my Xml looked as following:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> > <UpdateRQ>
> > <riders>
> > <rider>
> > <prename>Lance</prename>
> > <surname>Armstrong</surname>
> > </rider>
> > <rider>
> > <prename>Roberto</prename>
> > <surname>Heras</surname>
> > </rider>
> > <rider>
> > <prename>George</prename>
> > <surname>Hincapie</surname>
> > </rider>
> > </riders>
> > <Position>
> > <Element Operation="insert" remark="Test Add Remark1"/>
> > <Element Operation="insert" remark="Test Add Remark2"/>
> > </Position>
> > </UpdateRQ>
>
>
>
>
> *** Sent via Developersdex
http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!