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

Description

This method returns the namespace URI for the node.
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 was in the custom namespace you would use the prefix custom as shown:
   <field sid="testField">
      <custom:custom_option>value</custom:custom_option>
   </field>


Method

   public String getNamespaceURI( ) throws UWIException; 


Parameters

There are no parameters for this method.

Returns

The namespace URI or throws a generic exception (UWIException) if an error occurs.

Example

The following method uses recursion to traverse the entire node structure and destroys all nodes that are in the custom namespace identified by the following URI: http://www.ibm.com/xmlns/prod/XFDL/Custom. This method assumes that you are passing in 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();
         deleteCustomInfo(tempNode);
         tempNode = tempNode2;
      }
      
      /* If the node belongs to the custom namespace, delete it. */
 
      if (theNode.getNamespaceURI().equals
         ("http://www.ibm.com/xmlns/prod/XFDL/Custom"))
         theNode.destroy();
   }


Parent topic:
FormNodeP class