Community articleIsXFDL 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

Description

This function determines whether a node belongs to the XFDL namespace.
Each namespace is defined in the form by a namespace declaration, as shown:
   xmlns:xfdl="http://www.ibm.com/xmlns/prod/XFDL/7.5" 
   xmlns:custom="http://www.ibm.com/xmlns/prod/XFDL/Custom"

Each namespace declaration defines both a prefix and a URI for the namespace. In this sample, the prefix for the XFDL namespace is xfdl and the URI is http://www.ibm.com/xmlns/prod/XFDL/7.5.
Tags within the form are assigned specific namespaces by using the defined prefix. For example, to declare that an option is in the custom namespace, use the prefix custom as shown:
   <field sid="testField">
      <custom:custom_option>value</custom:custom_option>
   </field>


Function

   Function IsXFDL() As Boolean


Parameters

There are no parameters for this function.

Returns

True if the node belongs to the XFDL namespace, False if it does not, or throws an exception if an error occurs.

Example

The following function uses GetChildren and GetNext to walk through an entire form and deletes all information that is not in the XFDL namespace. The function uses IsXFDL to determine which nodes are in the XFDL namespace. Note that the function assumes that you are passing the root node of the form on the first call. Subsequent calls occur through recursion, which may provide any level of node.
   Sub DeleteCustomInfo(Node)
 
      Dim MainNode, TestNode  ' objects
      Dim TempInt
      
      ' Set the MainNode to be the child of the provided node.
      
      Set MainNode = Node.GetChildren
      
      ' Use recursion to step through each node in the form.  This routine
      ' walks to the last node in each page, then traverses back up the tree,
      ' deleting nodes that are not in the XFDL namespace as it goes.
 
      Do While (Not(MainNode Is Nothing))
         Set TestNode = MainNode.getNext
         DeleteCustomInfo(MainNode)
         Set MainNode = TestNode
      Loop
 
      ' Check to see if the node passed to the routine is in the XFDL
      ' namespace.  If not, delete the node.
 
      If Node.isXFDL = False Then
         Node.Destroy
      End If
 
   End Sub


Parent topic:
FormNodeP functions