Seaching for attributes

"Bashiro"<[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>

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


_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.