This documentation is archived and is not being maintained.

DocEvent Object

Office 2007
An event object that is used during a Microsoft Office InfoPath 2007 merge or view switching event.

Version Information
 Version Added:  InfoPath 2003

Remarks

The DocEvent object provides the XDocument property that can be used within a merge or view switching event to programmatically interact with the data in a form's underlying XML document.

The DocEvent object is passed as a parameter to the OnSwitchView and OnAfterChange events of an InfoPath form. The XDocument property that it provides is available only during these events.

For more information about using the DocEvent object, see Responding to form events.

Example

In the following example, the XDocument property of the DocEvent object is used to display the source XML of a form's underlying XML document using the DOM property of the XDocument object:

JScript
function XDocument::OnSwitchView(eventObj)
{
   XDocument.UI.Alert("The source XML: " + eventObj.XDocument.DOM.xml);
}



Show: