title: How to check the current node while iterating though nodes in Xml?
body: <p>I have to load values in a combo-box based on the values in the xml.</p>
  
  <p>When I the combo-box is to be loaded, the method </p>
  
  <pre><code>public static List&lt;String&gt; getVariableNames(Element thisElement, String type) {
  
      if (thisElement == null) {
          return new ArrayList&lt;String&gt;();
      }
      List&lt;String&gt; variableNames = new ArrayList&lt;String&gt;();
      List&lt;Element&gt; variableElements = thisElement.elements();
      for (Element nextElement : variableElements) {
          if (thisElement.equals(nextElement)) {
              break;
          } else if (isVariable(nextElement)) {
              String iteratedType = nextElement.attributeValue("TYPE");
              if (type.equals(iteratedType)) {
                  variableNames.add(nextElement.attributeValue("VARIABLENAME"));
              }
          }
      }
      return variableNames;
  }
  </code></pre>
  
  <p>is called.</p>
  
  <p>But this is not working.</p>
  
  <p>Is there any problem in this implementation?</p>