View.SelectNodes Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
SelectNodes(XPathNavigator) |
Selects a range of nodes in a view based on the specified starting XML node. |
SelectNodes(XPathNavigator, XPathNavigator) |
Selects a range of nodes in a view based on the specified starting XML node and ending XML node. |
SelectNodes(XPathNavigator, XPathNavigator, String) |
Selects a range of nodes in a view based on the specified starting XML node, the ending XML node, and the specified control. |
SelectNodes(XPathNavigator)
Selects a range of nodes in a view based on the specified starting XML node.
public:
abstract void SelectNodes(System::Xml::XPath::XPathNavigator ^ startNode);
public abstract void SelectNodes (System.Xml.XPath.XPathNavigator startNode);
abstract member SelectNodes : System.Xml.XPath.XPathNavigator -> unit
Public MustOverride Sub SelectNodes (startNode As XPathNavigator)
Parameters
- startNode
- XPathNavigator
An object that specifies the start node for the selection.
Exceptions
The SelectNodes method was called from an event handler for the Loading event.
The parameter passed to this method is a null reference (Nothing in Visual Basic).
The parameter passed to this method is not valid. For example, it is of the wrong type or format.
Examples
In the following example, the SelectNodes(startNode
) method is used to select the nodes in the first row in a Repeating Table control bound to group2.
// Create XPathNavigator and specify XPath for nodes.
XPathNavigator repeatingTableRow1 =
CreateNavigator().SelectSingleNode(
"/my:myFields/my:group1/my:group2[1]", NamespaceManager);
// Select nodes in specified XPathNavigator.
CurrentView.SelectNodes(repeatingTableRow1);
' Create XPathNavigator and specify XPath for nodes.
Dim repeatingTableRow1 As XPathNavigator = _
CreateNavigator().SelectSingleNode( _
"/my:myFields/my:group1/my:group2[1]", NamespaceManager)
' Select nodes in specified XPathNavigator.
CurrentView.SelectNodes(repeatingTableRow1)
Remarks
If the specified range of nodes is bound to more than one control in the view, you must use the SelectNodes(XPathNavigator, XPathNavigator, String) method. This allows you to specify the ViewContext identifier of the control that is bound to the range of nodes you want to select.
Note: The SelectNodes method requires that the specified nodes be structurally selectable in the view.
This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.
This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.
Applies to
SelectNodes(XPathNavigator, XPathNavigator)
Selects a range of nodes in a view based on the specified starting XML node and ending XML node.
public:
abstract void SelectNodes(System::Xml::XPath::XPathNavigator ^ startNode, System::Xml::XPath::XPathNavigator ^ endNode);
public abstract void SelectNodes (System.Xml.XPath.XPathNavigator startNode, System.Xml.XPath.XPathNavigator endNode);
abstract member SelectNodes : System.Xml.XPath.XPathNavigator * System.Xml.XPath.XPathNavigator -> unit
Public MustOverride Sub SelectNodes (startNode As XPathNavigator, endNode As XPathNavigator)
Parameters
- startNode
- XPathNavigator
An object that specifies the start node for the selection.
- endNode
- XPathNavigator
An object that specifies the end node for the selection.
Exceptions
The SelectNodes method was called from an event handler for the Loading event.
The parameters passed to this method are a null reference (Nothing in Visual Basic).
The parameters passed to this method are not valid. For example, they are of the wrong type or format.
Examples
In the following example, the SelectNodes(startNode
,endNode
) method is used to select the range of nodes starting from the first row to the third row in a Repeating Table control bound to group2.
// Create XPathNavigators to specify range of nodes.
XPathNavigator repeatingTableRow1 =
CreateNavigator().SelectSingleNode(
"/my:myFields/my:group1/my:group2[1]", NamespaceManager);
XPathNavigator repeatingTableRow3 =
CreateNavigator().SelectSingleNode(
"/my:myFields/my:group1/my:group2[3]", NamespaceManager);
// Select range of nodes in specified XPathNavigators.
CurrentView.SelectNodes(repeatingTableRow1, repeatingTableRow3);
' Create XPathNavigators to specify range of nodes.
Dim repeatingTableRow1 As XPathNavigator = _
CreateNavigator().SelectSingleNode( _
"/my:myFields/my:group1/my:group2[1]", NamespaceManager)
Dim repeatingTableRow2 As XPathNavigator = _
CreateNavigator().SelectSingleNode( _
"/my:myFields/my:group1/my:group2[3]", NamespaceManager)
' Select nodes in specified XPathNavigator.
CurrentView.SelectNodes(repeatingTableRow1, repeatingTableRow3)
Remarks
If the specified range of nodes is bound to more than one control in the view, you must use the SelectNodes(XPathNavigator, XPathNavigator, String) method. This allows you to specify the ViewContext identifier of the control that is bound to the range of nodes you want to select.
Note: The SelectNodes method requires that the specified nodes be structurally selectable in the view.
This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.
This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.
Applies to
SelectNodes(XPathNavigator, XPathNavigator, String)
Selects a range of nodes in a view based on the specified starting XML node, the ending XML node, and the specified control.
public:
abstract void SelectNodes(System::Xml::XPath::XPathNavigator ^ startNode, System::Xml::XPath::XPathNavigator ^ endNode, System::String ^ viewContext);
public abstract void SelectNodes (System.Xml.XPath.XPathNavigator startNode, System.Xml.XPath.XPathNavigator endNode, string viewContext);
abstract member SelectNodes : System.Xml.XPath.XPathNavigator * System.Xml.XPath.XPathNavigator * string -> unit
Public MustOverride Sub SelectNodes (startNode As XPathNavigator, endNode As XPathNavigator, viewContext As String)
Parameters
- startNode
- XPathNavigator
An object that specifies the start node for the selection.
- endNode
- XPathNavigator
An object that specifies the end node for the selection.
- viewContext
- String
The ViewContext identifier for the control or group in which to select text.
Exceptions
The SelectNodes method was called from an event handler for the Loading event.
The parameters passed to this method are a null reference (Nothing in Visual Basic).
The parameters passed to this method are not valid. For example, they are of the wrong type or format.
Examples
In the following example, group2 is bound to more than one Repeating Table control, one of which has the ViewContext identifier of "CTRL2". The SelectNodes(startNode
,endNode
,viewContext
) method is used to select the range of nodes starting from the first row to the third row that are bound to the control with the ViewContext identifier of "CTRL2".
// Create XPathNavigators to specify range of nodes.
XPathNavigator repeatingTableRow1 =
CreateNavigator().SelectSingleNode(
"/my:myFields/my:group1/my:group2[1]", NamespaceManager);
XPathNavigator repeatingTableRow3 =
CreateNavigator().SelectSingleNode(
"/my:myFields/my:group1/my:group2[3]", NamespaceManager);
// Select range of nodes in specified XPathNavigators.
CurrentView.SelectNodes(
repeatingTableRow1,
repeatingTableRow3,
"CTRL2");
' Create XPathNavigators to specify range of nodes.
Dim repeatingTableRow1 As XPathNavigator = _
CreateNavigator().SelectSingleNode( _
"/my:myFields/my:group1/my:group2[1]", NamespaceManager)
Dim repeatingTableRow2 As XPathNavigator = _
CreateNavigator().SelectSingleNode( _
"/my:myFields/my:group1/my:group2[3]", NamespaceManager)
' Select nodes in specified XPathNavigator.
CurrentView.SelectNodes( _
repeatingTableRow1, _
repeatingTableRow3, _
"CTRL2")
Remarks
When using the SelectNodes method, if the specified range of nodes is bound to more than one control in the view, you must also provide the ViewContext identifier to specify which control contains the nodes to select. You can determine the ViewContext identifier for a control by opening the form template in Design mode, displaying the control's Properties dialog box, and then clicking the Advanced tab.
When the ViewContext identifier is specified, all of the XML nodes that have been specified to be selected must be within that context.
Note: The SelectNodes method requires that the specified nodes be structurally selectable in the view.
This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.
This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.