NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

XmlNavigator.SelectSingle

Selects the first node that matches the specified expression.

[Visual Basic]
Overridable Public Function SelectSingle( _
   ByVal xpathexpr As Object _
) As Boolean
[C#]
public virtual bool SelectSingle(
   object xpathexpr
);
[C++]
public: virtual bool SelectSingle(
   Object* xpathexpr
);
[JScript]
public function SelectSingle(
   xpathexpr : Object
) : Boolean;

Parameters

xpathexpr
An XPath expression describing how to navigate. This can be a string or an object returned from the Compile method.

Return Value

true if a node was found; otherwise, false.

Exceptions

Exception Type Condition
ArgumentException The specified XPath expression is not a string or was not a result of a Compile method call.

Or the XPath expression does not return a node.

Remarks

This is the same as Select except it selects a only the first matching node. So instead of writing the following code:

[C#]

nav.Select("Customer/Address/Street");
if (nav.MoveToFirstSelected()) 
    street = nav.InnerText;

You would use this code:

[C#]

if (nav.SelectSingle("Customer/Address/Street"))
    street = nav.InnerText;

This method has no effect on the current selection state.

See Also

XmlNavigator Class | XmlNavigator Members | System.NewXml Namespace