Community articleUFLEncloseInstance function
Added by IBM contributorIBM on August 16, 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 modifies one instance in the data model, either updating information or appending information. Note that the form must have an existing data model.
Note: Use caution when calling this function. It can be used to overwrite signed instance data.


   r_short UFLEncloseInstance(
      formNodeP theNode,
      r_charP theInstanceID,
      r_charP theFile,
      r_u_long theFlags,
      r_charP theScheme,
      r_charP theRootReference,
      formNodeP theNSNode,
      r_short replaceNode


Table 1. Function parameters
theNode formNodePThe root node of the form or an XML instance node.
theInstanceIDr_charPThe ID of the instance node to create or replace. This is defined by the id attribute of that node, and is case sensitive.
If theNode parameter is the instance node you want to replace, set this parameter to NULL.
theFiler_charPThe path to the file on the local drive that contains the XML instance. Note that this file must be UTF-8.
theFlagsr_u_longReserved. Must be 0.
theSchemer_charPReserved. Must be NULL.
theRootReferencer_charPA reference to the node you want to replace or append children to. 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. This node defines the namespaces for the function. Use NULL if the node that this function is operating on has inherited the necessary namespaces.
replaceNoder_shortIf OK, the node specified by theRootReference is replaced with data. If NOTOK, the data is appended as the last child of the theRootReference node.


OK on success or an error code on failure.


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

Parent topic:
FormNodeP functions