Community articleGetNamespaceURI 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 returns the namespace URI 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 was in the custom namespace you would use the prefix custom as shown:
   <field sid="testField">


   Function GetNamespaceURI() As String


There are no parameters for this function.


The namespace URI or throws an exception if an error occurs.


The following function uses GetChildren and GetNext to walk through an entire form. While walking through the form, it uses GetNamespaceURI to determine whether each node is in the Custom namespace identified by the following URI: If so, the function destroys the node. This 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 DeleteCustomNamespace(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
         Set MainNode = TestNode
      ' Check to see if the node passed to the routine is in the Custom
      ' namespace.  If so, delete the node.
      If Node.GetNamespaceURI = "" Then
      End If
   End Sub

Parent topic:
FormNodeP functions