Community articlegetPrefix method
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 method 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.


   public String getPrefix( ) throws UWIException;


There are no parameters for this method.


The prefix for the node's namespace or throws a generic exception (UWIException) if an error occurs.


The following method removes all nodes from the form that have a namespace prefix of "custom". The method 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 method assumes that you are passing it the root node of the form.
   private static void deleteCustomInfo(FormNodeP theNode) throws Exception
   FormNodeP tempNode, tempNode2;
      /* Use recursion to step through each node of the form. */
      tempNode = theNode.getChildren();
      while(tempNode != null)
         tempNode2 = tempNode.getNext();
         tempNode = tempNode2;
      /* If the node is in the custom namespace, delete it. */
      if (theNode.getPrefix().equals("custom"))

Parent topic:
FormNodeP class