Export (0) Print
Expand All

XDocument Object

Office 2007
Represents the underlying XML document of a Microsoft Office InfoPath 2007 form.

Version Information
 Version Added:  InfoPath 2003

Remarks

The XDocument object is a key object in the InfoPath object model that provides properties, methods, and events that can be used to programmatically interact with and manipulate the source XML data of a form.

Bb229879.vs_note(en-us,office.12).gif  Note
The XDocument object is embedded in the InfoPath script engine. While the XDocument object can be accessed using the XDocuments collection, in most cases you will access it directly, without going through the collection.

The source XML data of a form takes the form of an XML Document Object Model (DOM), which is accessed through the DOM property of the XDocument object. The XDocument object also provides a number of properties that can be used to get information about the form and its underlying XML document. For example, the following code checks to see whether data in the form has been changed by using the IsDirty property:

JScript
if (XDocument.IsDirty)
   XDocument.UI.Alert("Form has been changed.");
else
   XDocument.UI.Alert("Form has not been changed.");

In addition to information about the form and its underlying XML document, the XDocument object provides a number of methods that can be used on the form, such as printing, saving, and submitting. It also provides a number of events that can be used to respond to various actions that occur at the form level, such as loading of a form, switching views, or a merge operation.

The XDocument object can be accessed in a variety places within the InfoPath object model. The following table summarizes the locations where the XDocument object is available.

NameDescription
XDocuments collectionAccessed from the Application object. Provides the Item property for accessing the the XDocument objects that it contains.
DataDOMEvent objectProvides an XDocument property for accessing the source XML data during an XML DOM change.
DocActionEvent objectProvides an XDocument property for accessing the source XML data during a button click in the form area.
DocEvent objectProvides an XDocument property for accessing the source XML data during a switch view or form merge operation.
DocReturnEvent objectProvides an XDocument property for accessing the source XML during the loading or submission of a form.
VersionUpgradeEvent objectProvides an XDocument property for accessing the source XML during during the version upgrade operation.
Window objectProvides an XDocument property for accessing the XDocument object associated with the window.
Bb229879.vs_note(en-us,office.12).gif  Note
For more information about using the XDocument object , see Working with data in a form's underlying XML document.



Community Additions

ADD
Show:
© 2014 Microsoft