1 2 3 4 5 6 7 8 9 10 11 12
|
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01021254"><META NAME="lcid" CONTENT="1033"><title>XDocument Object</title><link rel="stylesheet" type="text/css" href="office10.css"><script type="text/javascript" language="Javascript" src="ExpCollapse.js"></script><script type="text/javascript" language="JavaScript" src="inline.js"></script></head><body><p id="ExpandAllLine" class="ExpFav"><a href="#" onclick="ExpandAll()" onkeypress="ExpandAll()" class="DropDown"><img id="picHeader" border="0" src="expandtri.gif" alt="Show All"><span id="ExpandAll">Show All</span></a></p><h1>XDocument Object</h1><div class="ofvbanav"><span class="ofvbanavreuse" id="seealso" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="properties" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="methods" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="events" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="specifics" onclick="toggleList()" onkeypress="toggleList()"></span></div><table class="ofvbaomart"><tr><td class="noborder" nowrap="true"><A HREF="xdcolXDocuments.htm" title="XDocuments"><SPAN tabindex="0" class="omyellow" id="ParentObject">XDocuments</SPAN></A><BR /><IMG SRC="../img/parchild.gif" BORDER="0"></IMG><A HREF="xdobjXDocument.htm" title="XDocument"><SPAN class="omblue">XDocument</SPAN></A><br /></td></tr></table><p>Represents the underlying XML document of a Microsoft Office InfoPath 2003 form.</p><h2>Remarks</h2><p>The <b class="bterm">XDocument</b> 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. </p><p><b>Note</b> The <b class="bterm">XDocument</b> object is embedded in the InfoPath script engine. While the <b class="bterm">XDocument</b> object can be accessed using the <b class="bterm"><a href="xdcolXDocuments.htm" id="HV01021190" lcid=" ">XDocuments</a></b> collection, in most cases you will access it directly, without going through the collection.</p><h2>Using the XDocument object</h2><p>The source XML data of a form takes the form of an XML <a href="#" class="glossary" onclick="AppendPopup(this,'ofdocumentobjectmodeldom')" onkeypress="AppendPopup(this,'ofdocumentobjectmodeldom')">Document Object Model (DOM)</a>, which is accessed through the <b class="bterm"><a href="xdproDOM_2.htm" id="HV01032776" lcid=" ">DOM</a></b> property of the <b class="bterm">XDocument</b> object. The <b class="bterm">XDocument</b> 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 <b class="bterm"><a href="xdproIsDirty.htm" id="HV01021288" lcid=" ">IsDirty</a></b> property:</p><pre><code>if (XDocument.IsDirty)
XDocument.UI.Alert("Form has been changed.");
else
XDocument.UI.Alert("Form has not been changed.");</code></pre><p>In addition to information about the form and its underlying XML document, the <b class="bterm">XDocument</b> 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.</p><h2>Accessing the XDocument object</h2><p>The <b class="bterm">XDocument</b> object can be accessed in a variety places within the InfoPath object model. The following table summarizes the locations where the <b class="bterm">XDocument</b> object is available.</p><table><tr><th>Name</th><th>Description</th></tr><tr><td><b class="bterm"><a href="xdcolXDocuments.htm" id="HV01021190" lcid=" ">XDocuments</a></b> collection</td><td>Accessed from the <b class="bterm"><a href="xdobjApplication.htm" id="HV01021256" lcid=" ">Application</a></b> object. Provides the <b class="bterm"><a href="xdproItem_2.htm" id="HV01021295" lcid=" ">Item</a></b> property for accessing the the <b class="bterm">XDocument</b> objects that it contains.</td></tr><tr><td><b class="bterm"><a href="xdobjDataDOMEvent.htm" id="HV01021239" lcid=" ">DataDOMEvent</a></b> object</td><td>Provides an <b class="bterm"><a href="xdproXDocument_2.htm" id="HV01021360" lcid=" ">XDocument</a></b> property for accessing the source XML data during an XML DOM change.</td></tr><tr><td><b class="bterm"><a href="xdobjDocActionEvent.htm" id="HV01021240" lcid=" ">DocActionEvent</a></b> object</td><td>Provides an <b class="bterm"><a href="xdproXDocument_3.htm" id="HV01021361" lcid=" ">XDocument</a></b> property for accessing the source XML data during a button click in the form area.</td></tr><tr><td><b class="bterm"><a href="xdobjDocEvent.htm" id="HV01021241" lcid=" ">DocEvent</a></b> object</td><td>Provides an <b class="bterm"><a href="xdproXDocument_4.htm" id="HV01021362" lcid=" ">XDocument</a></b> property for accessing the source XML data during a switch view or form merge operation.</td></tr><tr><td><b class="bterm"><a href="xdobjDocReturnEvent.htm" id="HV01021242" lcid=" ">DocReturnEvent</a></b> object</td><td>Provides an <b class="bterm"><a href="xdproXDocument_5.htm" id="HV01021363" lcid=" ">XDocument</a></b> property for accessing the source XML during the loading or submission of a form.</td></tr><tr><td><b class="bterm"><a href="xdobjVersionUpgradeEvent.htm" id="HV01021248" lcid=" ">VersionUpgradeEvent</a></b> object</td><td>Provides an <b class="bterm"><a href="xdproXDocument_6.htm" id="HV01021364" lcid=" ">XDocument</a></b> property for accessing the source XML during during the version upgrade operation.</td></tr><tr><td><b class="bterm"><a href="xdobjWindow.htm" id="HV01021252" lcid=" ">Window</a></b> object</td><td>Provides an <b class="bterm"><a href="xdproXDocument_1.htm" id="HV01021359" lcid=" ">XDocument</a></b> property for accessing the <b class="bterm">XDocument</b> object associated with the window.</td></tr></table><p><b>Note</b> For more information about using the <b class="bterm">XDocument</b> object , see <a href="inconAccessingFormData.htm" id="HV01039907" lcid=" ">Accessing form data</a>.</p><script type="text/javascript" language="JScript" src="ofvbanl.js"></script><span id="ofVBAISpan" class="ofvbaispan"><iframe id="ofVBAIFrame" frameborder="0" marginheight="0" marginwidth="4" scrolling="auto" width="100%" src="../links/xdobjXDocument_l.htm"></iframe></span><center><a href="XMLSchemaCopyright_HV01147162.htm">©2003-2004 Microsoft Corporation. All rights reserved.</a>
Permission to copy, display and distribute this document is available at: <a
href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT010988631033&CTT=11&Origin=HV011232471033"
target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>
|