[jdom-interest] Seaching for attributes

Bashiro bashiro at myway.com
Fri Nov 23 12:23:33 PST 2007



Hello folks,
I am trying to use jdom to seach for attribute values.
When found I get a value in return. 
I want the code to return  a message  when not found.
I have the ff code;

Iterator iterator = attributes.iterator();
      while (iterator.hasNext()) {
        Attribute attribute = (Attribute) iterator.next();
        String name = attribute.getName();
        String value = attribute.getValue();
              if(name.equals("xml_name")&&value.equals(xml_value.trim())){
             jTextArea1.append(" Domain Exists: " + value + "\n"); 
             return;
            }
        else {
           //jTextArea1.append(" No such domain \n"); 
           } 


The problem is if I uncomment "the else clause" it appends "No such domain" on any value that does not march. 
In other words if the no march values are 50, the code appends "No such domain" 50 times. How do I let the code to append only one time "No such domain"

Thanks in advance
Bashiro

_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com




More information about the jdom-interest mailing list