Community articleExtractInstance function
Added by IBM contributorIBM on August 15, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.


This function copies an instance from a form's XML model to a file. Note that this function does not remove the instance from the form.
Call this function on the root node of the form or an XML instance node.


   Sub ExtractInstance(
      theInstanceID As String, 
      theFilter As IFormNodeP, 
      includeNamespaces As String, 
      theFile As String, 
      theFlags As Long, 
      theScheme As String, 
      theRootReference As String, 
      theNSNode As IFormNodeP)


Table 1. Function parameters
theInstanceIDStringThe ID of the instance node to extract. This is defined by the id attribute of that node.
To extract the root node of the form, set this parameter to null.
theFilterIFormNodePAn item in the form, such as a button or cell, that defines the filtering for the instance. Filtering of elements is controlled by the transmit filters in the item. If all of an element's bound options are filtered out, then the element is also filtered out. Use null.for no filtering.
includedNamespacesStringIf set to null, a definition for each inherited namespace is added to the root node of the instance when it is extracted.
To filter the namespaces, list the prefixes for those namespaces you want to include in the instance, separated by spaces.
For example, to include only the xfdl and custom namespaces, you would set this parameter to:
   xfdl custom

Use #default to indicate the default namespace for the instance.
Use an empty string ("") to include only those namespaces that are used by the instance.
Namespaces that are used in the instance are always included, regardless of this setting.
theFileStringThe path to the file on the local drive that will contain the XML instance.
theFlagsLongReserved. This must be 0.
theSchemeStringReserved. Must be null.
theRootReferenceStringA reference to the node you want to extract. This reference is relative to the instance node.
Use null to default to the instance node.
theNSNodeIFormNodePA node that inherits the namespaces used in the reference. It defines the namespaces for the function. Use null if the node that this function is operating on has inherited the necessary namespaces.


Nothing if call is successful or throws a generic exception (UWIException) if an error occurs.


The following example shows a function that takes the root node of a form and extracts an XML instance.
   Sub SaveDataInstance(Form)
      Form.ExtractInstance "Test", Nothing, vbNullString, _
         "c:\InstanceData.txt", 0, vbNullString, vbNullString, Nothing
   End Sub

Parent topic:
FormNodeP functions