DataSource.CreateNavigator Method

Returns an XPathNavigator object for accessing and editing the data source.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustOverride Function CreateNavigator As XPathNavigator
'Usage
Dim instance As DataSource
Dim returnValue As XPathNavigator

returnValue = instance.CreateNavigator()
public abstract XPathNavigator CreateNavigator()

Return Value

Type: System.Xml.XPath.XPathNavigator
An XPathNavigator object positioned at the root node of the data source.

Remarks

The CreateNavigator() method allows you to programmatically access and manipulate the stored data of a data source represented by the DataSource object. You can use any of the properties and methods that are supported by the XPathNavigator class to work with the data source.

The CreateNavigator() method replaces the DOM property of the DataObject object used in the Microsoft InfoPath 2003 object model.

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 from code running in forms opened in Microsoft InfoPath Filler or in a Web browser.

Examples

In the following example, an XPathNavigator object is created for the "CityList" data source using the CreateNavigator() method, and then the XML of the data source is displayed in a message box.

XPathNavigator myNavigator = 
   this.DataSources["CityList"].CreateNavigator();
MessageBox.Show("Data source XML: " + myNavigator.OuterXml.ToString());
Dim myNavigator As XPathNavigator  = 
   Me.DataSources("CityList").CreateNavigator()
MessageBox.Show("Data source XML: " & myNavigator.OuterXml.ToString())

See Also

Reference

DataSource Class

DataSource Members

Microsoft.Office.InfoPath Namespace