Re: Looping through attributes

"Grzegorz Kaczor" <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
No :).
boolean found = falsefor (...)  {  if ("domain".equals(...)) {     ...     found = true;     break;  }}
So not found will be displayed once.
But better use Michael's way, it is ok.
String value = element.getAtttibute("domain");if (value == null || (!value.equals(dom.trim()))) display "not found"
Regards,Grzegorz
2008/1/22, Bashiro <[email protected]>:>>> Thanks,>> Theoriticaly yes, but practically no!> When boolean is false, that is when the value of an attribute is not found,> jdom displays as many "not founds" as the number of contens in the xml.>> I am beguining to think if I should combine HashMap so that Hashmap will check before passing it on to the jdom code.> I thought jdom could do this easier....>> Bashiro> Drammen-Norway>>>>>  --- On Tue 01/22, Grzegorz Kaczor < [email protected] > wrote:> From: Grzegorz Kaczor [mailto: [email protected]]> To: [email protected]>      Cc: [email protected]> Date: Tue, 22 Jan 2008 20:33:37 +0100> Subject: Re: [jdom-interest] Looping through attributes>> Hi>> Thanks for the mail.> And thanks for warning me about the else clause.> Do you have any suggestions on how to let jdom> display a message when the attribute is not dound ?To have a boolean variable 'found' initialized to false before theloop, set it to true on find and use 'break' instead of 'return'? Justa suggestion.Grzegorz>> _______________________________________________> 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]>

-- "Choć tyle wiemy własnym doświadczeniem:W nas jest Raj, Piekło - i do obu - szlaki."J.K.
_______________________________________________
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.