Community articleUFLExtractInstance function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars


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.


   r_short UFLExtractInstance(
      formNodeP theNode,
      r_charP theInstanceID,
      formNodeP theFilter,
      r_charP includedNamespaces,
      r_charP theFile,
      r_u_long theFlags,
      r_charP theScheme,
      r_charP theRootReference,
      formNodeP theNSNode


Table 1. Function parameters
theNode formNodePThe root node of the form or an XML instance node.
theInstanceIDr_charPThe ID of the instance node to extract. This is defined by the id attribute of that node.
If theNode parameter is the instance node you want to extract, set this parameter to NULL.
theFilterformNodePAn 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.
includedNamespacesr_charPIf 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.
theFiler_charPThe path to the file on the local drive that will contain the XML instance.
theFlagsr_u_longReserved. This must be 0.
theSchemer_charPReserved. Must be NULL.
theRootReferencer_charPA reference to the node you want to extract. This reference is relative to the instance node.
Use NULL to default to the instance node.
theNSNodeformNodePA 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.


OK on success or an error code on failure.


The following example shows a function that takes the root node of a form and extracts an XML instance.
   r_error updateDataInstance(formNodeP theForm)
      if (UFLExtractInstance(theForm, "data", NULL, NULL,
         "c:\Instance Files\Personnel\tempdata.dat", 0, NULL, NULL, NULL) 
         != OK)
         fprintf(stderr, "Could not extract data instance.");

Parent topic:
FormNodeP functions