編輯

共用方式為


XDocument Interface

Definition

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

public interface class XDocument : Microsoft::Office::Interop::InfoPath::_XDocument2, Microsoft::Office::Interop::InfoPath::_XDocumentEventSink2_Event
[System.Runtime.InteropServices.Guid("096CD6A8-0786-11D1-95FA-0080C78EE3BB")]
public interface XDocument : Microsoft.Office.Interop.InfoPath._XDocument2, Microsoft.Office.Interop.InfoPath._XDocumentEventSink2_Event
type XDocument = interface
    interface _XDocument2
    interface _XDocumentEventSink2_Event
Public Interface XDocument
Implements _XDocument2, _XDocumentEventSink2_Event
Derived
Attributes
Implements

Examples

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:

if (thisXDocument.IsDirty)
{
   thisXDocument.UI.Alert("Form has been changed.");
}
else
{
   thisXDocument.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.

For another sample that demonstrates working with the XDocument object, see

How to: Access Application Data Using the InfoPath 2003 Object Model.

Remarks

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, see_XDocument3.

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.

While the XDocument object can be accessed using the XDocumentsCollection collection, in most cases you will access it from the thisXDocument variable that is instantiated in the _Startup method of a managed-code project 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. The XDocument object also provides a number of properties that can be used to get information about the form and its underlying XML document. It also provides a number of methods that can be used on the form, such as printing, saving, and submitting. The XDocument object 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.

Accessing the XDocument Object

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.

XDocumentsCollection Accessed from Application. Provides Item[Object] for accessing the XDocument objects that it contains.
DataDOMEventObject Provides XDocument for accessing the source XML data during an XML DOM change.
DocActionEventObject Provides XDocument for accessing the source XML data during a button click in the form area.
DocEventObject Provides XDocument for accessing the source XML data during a switch view or form merge operation.
DocReturnEventObject Provides XDocument for accessing the source XML during the loading or submission of a form.
VersionUpgradeEventObject Provides XDocument for accessing the source XML during the version upgrade operation.
WindowObject Provides XDocument for accessing the XDocument object associated with the window.

Properties

DataAdapters

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeDataAdapters.

(Inherited from _XDocument2)
DataObjects

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeDataObjects.

(Inherited from _XDocument2)
DOM

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeDOM.

(Inherited from _XDocument2)
Errors

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeErrors.

(Inherited from _XDocument2)
Extension

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeExtension.

(Inherited from _XDocument2)
IsDirty

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeIsDirty.

(Inherited from _XDocument2)
IsDOMReadOnly

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeIsDOMReadOnly.

(Inherited from _XDocument2)
IsNew

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeIsNew.

(Inherited from _XDocument2)
IsReadOnly

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeIsReadOnly.

(Inherited from _XDocument2)
IsRecovered

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeIsRecovered.

(Inherited from _XDocument2)
IsSigned

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeIsSigned.

(Inherited from _XDocument2)
Language

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeLanguage.

(Inherited from _XDocument2)
QueryAdapter

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeQueryAdapter.

(Inherited from _XDocument2)
Role

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeRole.

(Inherited from _XDocument2)
SignedDataBlocks

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeSignedDataBlocks.

(Inherited from _XDocument2)
Solution

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeSolution.

(Inherited from _XDocument2)
UI

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeUI.

(Inherited from _XDocument2)
URI

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeURI.

(Inherited from _XDocument2)
Util

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeUtil.

(Inherited from _XDocument2)
View

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeView.

(Inherited from _XDocument2)
ViewInfos

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeViewInfos.

(Inherited from _XDocument2)

Methods

add_OnAfterImport(_XDocumentEventSink2_OnAfterImportEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
add_OnContextChange(_XDocumentEventSink2_OnContextChangeEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
add_OnLoad(_XDocumentEventSink2_OnLoadEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
add_OnMergeRequest(_XDocumentEventSink2_OnMergeRequestEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
add_OnSaveRequest(_XDocumentEventSink2_OnSaveRequestEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
add_OnSign(_XDocumentEventSink2_OnSignEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
add_OnSubmitRequest(_XDocumentEventSink2_OnSubmitRequestEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
add_OnSwitchView(_XDocumentEventSink2_OnSwitchViewEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
add_OnVersionUpgrade(_XDocumentEventSink2_OnVersionUpgradeEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
CreateDOM()

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeCreateDOM().

(Inherited from _XDocument2)
GetDataVariable(Int32)

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeGetDataVariable(Int32).

(Inherited from _XDocument2)
GetDOM(String)

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeGetDOM(String).

(Inherited from _XDocument2)
GetNamedNodeProperty(Object, String, String)

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeGetNamedNodeProperty(Object, String, String).

(Inherited from _XDocument2)
ImportDOM(IXMLDOMDocument)

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeImportDOM(IXMLDOMDocument).

(Inherited from _XDocument2)
ImportFile(String)

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeImportFile(String).

(Inherited from _XDocument2)
PrintOut()

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seePrintOut().

(Inherited from _XDocument2)
Query()

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeQuery().

(Inherited from _XDocument2)
remove_OnAfterImport(_XDocumentEventSink2_OnAfterImportEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
remove_OnContextChange(_XDocumentEventSink2_OnContextChangeEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
remove_OnLoad(_XDocumentEventSink2_OnLoadEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
remove_OnMergeRequest(_XDocumentEventSink2_OnMergeRequestEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
remove_OnSaveRequest(_XDocumentEventSink2_OnSaveRequestEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
remove_OnSign(_XDocumentEventSink2_OnSignEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
remove_OnSubmitRequest(_XDocumentEventSink2_OnSubmitRequestEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
remove_OnSwitchView(_XDocumentEventSink2_OnSwitchViewEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
remove_OnVersionUpgrade(_XDocumentEventSink2_OnVersionUpgradeEventHandler)

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
Save()

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeSave().

(Inherited from _XDocument2)
SaveAs(String)

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeSaveAs(String).

(Inherited from _XDocument2)
SetDataVariable(Int32, String)

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeSetDataVariable(Int32, String).

(Inherited from _XDocument2)
SetDirty(Boolean)

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeSetDirty(Boolean).

(Inherited from _XDocument2)
SetNamedNodeProperty(IXMLDOMNode, String, String)

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeSetNamedNodeProperty(IXMLDOMNode, String, String).

(Inherited from _XDocument2)
Submit()

This member is a wrapper for a member of a COM interface that has been superseded by a later version. The later version of this interface implements all members of earlier interfaces and additional new members. For information about this member as it is implemented in the later interface, including usage, remarks, and examples, seeSubmit().

(Inherited from _XDocument2)

Events

OnAfterImport

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
OnContextChange

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
OnLoad

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
OnMergeRequest

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
OnSaveRequest

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
OnSign

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
OnSubmitRequest

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
OnSwitchView

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)
OnVersionUpgrade

This type is a wrapper for a coclass or coclass member that is required by managed code for COM interoperability. This class is not intended to be used in code.

(Inherited from _XDocumentEventSink2_Event)

Applies to