Community articlegetNodeType method
Added by IBM contributorIBM on August 15, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.



Description

This method returns the type for a node (for example, page, item, option, and array). This allows you to quickly determine the type of node you are working with and what depth you are at in the node hierarchy.

Method

   public int getNodeType( ) throws UWIException;


Parameters

There are no parameters for this method.

Returns

One of the following types:
  • FormNodeP.UFL_FORM — The root node of the form.
  • FormNodeP.UFL_PAGE — A page level node.
  • FormNodeP.UFL_ITEM — An item level node.
  • FormNodeP.UFL_OPTION — An option level node.
  • FormNodeP.UFL_ARRAY — An argument level node, such as an array element.
This method throws a generic exception (UWIException) if an error occurs.

Example

The following method receives a node below the page level and uses getParent to ascend the hierarchy until it reaches a page node, as detected by getNodeType.
   private static FormNodeP ascendToPage(FormNodeP theNode) throws Exception
   {
      while ((theNode != null) && (theNode.getNodeType() !=
         FormNodeP.UFL_PAGE))
      {
         theNode = theNode.getParent();
      }
      return(theNode);
   }


Parent topic:
FormNodeP class