[jdom-interest] Looping through attributes

Bashiro bashiro at myway.com
Mon Jan 21 18:01:02 PST 2008

Thanks for the reply. I appreciate this;

here is the snip code;

public  void searchDomain(Element element, String dom) {
    List attributes = element.getAttributes();
    if (!attributes.isEmpty()) {
      Iterator iterator = attributes.iterator();
      while (iterator.hasNext()) {
        Attribute attribute = (Attribute) iterator.next();
        String name = attribute.getName();
        String value = attribute.getValue();
             jTextArea1.append(" Domain Exists: " + value + "\n"); 
        else {
          System.out.println("Domain does not exist  " +(dom));      



 --- On Mon 01/21, Michael Kay < mike at saxonica.com > wrote:
From: Michael Kay [mailto: mike at saxonica.com]
To: bashiro at myway.com, jdom-interest at jdom.org
Date: Mon, 21 Jan 2008 21:09:29 -0000
Subject: RE: [jdom-interest] Looping through attributes

Show us your input, show us your code, and we can help you understand whereyou have gone wrong. JDOM doesn't do anything unless you ask it to.Michael Kayhttp://www.saxonica.com/> > Hello folks,> There is one thing bodering me and I hope someone could help.> When I loop through attributes to search for values. How do I > stop jdom from not printing on any attribute that it loops through.> > Example:> I search for an attribute "domain" when the corresponding > value matches jdom returns found. But when not found; it > prints on all attributes and I get a list of not found, not > found, corresponding to the number of attributes in the documents.> > What code or how do i tell jdom to print "not found" only one time?> > Bashiro> Drammen-Norway> > > _______________________________________________> 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/youraddr@you> rhost.com

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