XDocument Object


XDocument Object

The XDocument object represents the underlying XML document for all InfoPath forms. This is the most important object in the InfoPath object model and is the main source for access and manipulation of the underlying XML data of a form, as shown in Table A.7.

Table A.7: XDocument Object Properties and Methods .

Name

Security Level

Description

GetDOM Method

2

Returns a reference to the DOM object for the specified DataObject. Once the reference is obtained, form designers can access any of the standard DOM properties and methods.

ImportFile Method

2

Imports or merges a specified form data with the currently open form.

PrintOut Method

3

Uses the currently defined printer settings and prints the form content as it is rendered in the form s window.

Query Method

2

Retrieves data from the associated data adapter object and then stores it in the underlying XML DOM.

Save Method

3

Saves the form using the default URN.

SaveAs Method

3

Saves the form to the specified URL and overrides the default URN.

GetDataVariable Method

2

Returns a string that contains a variable stored in the processing instruction of the underlying XML attribute and set using the SetDataVariable method.

SetDataVariable Method

2

Sets a variable within the processing instructions that can be retrieved using the GetDataVariable . Currently, InfoPath supports only the InitialViews variable for the default view.

Submit Method

2

Calls the type of submit operation that is specified in the form s options during design mode.

DOM Property

2

Returns a reference to the XML DOM that contains the form s source XML data.

Errors Property

2

Is a read-only property that contains a reference to the underlying Errors collection.

DataObject Property

2

Is a read-only property that returns a reference to the DataObject collection.

IsDirty Property

2

Is a read-only property that returns a Boolean indicating if the underlying data has been changed.

IsDOMReadOnly Property

2

Returns a Boolean indicating if the underlying XML DOM is read only. This will occur if the form is digitally signed or during the OnBeforeChange event and during the OnValidate event.

IsReadOnly Property

2

Is a Boolean indicating if the form is in read-only mode.

IsSigned Property

2

Is a Boolean indicating if the current form has been digitally signed.

Language Property

2

Retrieves the current defined language code for the form.

IsNew Property

2

Is a read-only property that indicates whether the form has been saved.

Solution Property

2

Returns a read-only reference to the Solution object.

UI Property

2

Returns a read-only reference to the UI property.

URI Property

2

Is a read-only string that contains the URI of the form.

View Property

2

Returns a read-only reference to the View object.

ViewInfos Property

2

Returns a read-only reference to the ViewInfos collection.

Extension Property

2

Returns a read only reference to the global scripting object.

QueryAdapter Property

2

Is a read-only reference to the data adapter object associated with the current form.

Note  

For form performance and accessibility, this object is embedded directly in the script engine. While it can be accessed through the XDocuments collection, it can also be accessed directly without going through the collection.

The XDocument object is used to access the current form s underlying XML document. The DOM property of the XDocument object returns a reference to the XML DOM that is populated with the source XML data of a form.

This object also implements the event objects shown in Table A.8.

Table A.8: Event Objects for The XDocument Object.

Name

Description

DataDomEvent Object

An event accessed during data validation.

DocEvent Object

An event fired during a merge or view switching event that allows programmatic access and interaction with the underlying XML document.

DocReturnEvent Object

An event object that fires during a form load or submission event. The event enables access to the underlying XML data.

DocActionEvent

An event object that is used during a button click event.

VersionUpgradeEvent

An event object that fires during a form version upgrade event. The event enables the interaction with the underlying XML and form template to determine version and template information.

The following example shows how to create a pop-up dialog box that contains the underlying XML information within a form:

 XDocument.UI.Alert(XDocument.DOM.xml) 



Programming Microsoft Infopath. A Developers Guide
Programming Microsoft Infopath: A Developers Guide
ISBN: 1584504536
EAN: 2147483647
Year: 2006
Pages: 111
Authors: Thom Robbins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net