|InfoPath Developer Reference|
Version Added: InfoPath 2003
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.
For more information about using the DocEvent object, see Responding to form events.
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: