Community articleGetPrefix function
Added by IBM contributorIBM on May 2, 2012
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 returns the namespace prefix for the node.
Each namespace is defined in the form by a namespace declaration, as shown:

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
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">

Note: A given prefix may not always resolve to the same namespace. Different portions of the form may define the prefix differently. For example, the custom prefix may resolve to a different namespace on the first page of a form than it does on the following pages.


   Function GetPrefix() As String


There are no parameters for this function.


The prefix for the node's namespace or throws an exception if an error occurs.


The following function removes all nodes from the form that have a namespace prefix of "custom". The function walks through the form using GetChildren and GetNext in a recursive loop. While walking the form, it uses GetPrefix to locate nodes in the custom namespace and deletes them using Destroy. This function assumes that you are passing it the root node of the form.
   Sub DeleteCustomPrefix(Node)
      Dim TempNode, TempNode2  ' IFormNodeP
      ' Use recursion to step through each node of the form.
      Set TempNode = Node.GetChildren
      Do While (Not(TempNode is Nothing))
         Set TempNode2 = TempNode.GetNext
         Set TempNode = TempNode2
      ' If the node has a namespace prefix of "custom", delete it.
      If (Node.GetPrefix = "custom") Then
      End If
   End Sub

Parent topic:
FormNodeP functions