Community articlegetLocalName 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 local name of a given node. The local name is determined by the XML tag that represents that node. For example, examine the following XML fragment:
   <page sid="PAGE1">
      <global sid="global"></global>
      <field sid="testField">
         <bgcolor>120, 120, 120</bgcolor>

In this sample, the name of the page node is "page", the name of the field node is "field", the name of the value node is "value", and the name of the bgcolor node is "bgcolor".
Note that the local name does not include any namespace prefix that might exist. For example, you might have a custom option in a different namespace as shown:
   <field sid="testField">

In this case, the local name of the custom option is returned without the prefix, resulting in "my_option".


   public String getLocalName( ) throws UWIException;


There are no parameters for this method.


The name of the node or throws a generic exception (UWIException) if an error occurs.


The following method takes the root node of the form and uses recursion to step through each node in the form. The method uses isXFDL and getLocalName to locate all label nodes in the XFDL namespace and changes the background color of those nodes to green.
   private static void changeLabelColor(FormNodeP theNode) throws Exception
   FormNodeP tempNode, bgcolorNode;
      /* Use recursion to step through each node in the form. */
      tempNode = theNode.getChildren();
      while(tempNode != null)
         tempNode = tempNode.getNext()
      /* If the node is a label in the XFDL namespace, set the bgcolor
         option to "green". */
      if ((theNode.isXFDL()) && (theNode.getLocalName.equals("label")))
         theNode.SetLiteralByRefEx(null, "bgcolor[0]", 0, null, null,

Parent topic:
FormNodeP class