This documentation is archived and is not being maintained.

DataSource.CreateNavigator Method (Microsoft.Office.InfoPath)

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

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

public abstract XPathNavigator CreateNavigator ()

Return Value

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

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 Office InfoPath 2007 or in a Web browser.

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 = 
MessageBox.Show("Data source XML: " + myNavigator.OuterXml.ToString());