Edit

Share via


DataSource.CreateNavigator Method

Definition

Returns an XPathNavigator

public:
 abstract System::Xml::XPath::XPathNavigator ^ CreateNavigator();
public abstract System.Xml.XPath.XPathNavigator CreateNavigator ();
abstract member CreateNavigator : unit -> System.Xml.XPath.XPathNavigator
Public MustOverride Function CreateNavigator () As XPathNavigator

Returns

An XPathNavigator object positioned at the root node of the data source.

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())

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.

Applies to