[jdom-interest] beta5 comments

Louis Calisi louisc at bu.edu
Fri Sep 29 07:53:37 PDT 2000


    Well I decided to give JDOM a whirl since the unofficial new beta is out. The
build script worked fine on my Irix machine. I also had no trouble converting my
project over to JDOM except for one snag which I think may be a bug.

    I'm building a JTree using XML and right now it only looks for the attribute
"name" in the tags to label the nodes in the JTree. Below is the relevant piece of
the code. I left out the recursive part for finding out if an element has children.
My program builds the structure of the JTree perfectly but it labels the nodes
wrong. I'm assuming the code bellow will label the nodes with the attribute called
name.


        while (i.hasNext()) {
            Element nd = (Element) i.next();
            node.add(new DefaultMutableTreeNode(
                nd.getAttributeValue("name"));
        }


    Part of the xml document that I am using looks like this:

<WORLD name="Earth"
    <HEMISPHERE name="North">
        <COUNTRY name="Germany"/>
........

    As it works now the code builds an JTree that looks like this:

World
  |
  |----Hemisphere
  |
  |------------- Country

.....

    Am I doing something wrong or is this a bug. Thanks in advance for any help
anyone can offer.


Louis Calisi






More information about the jdom-interest mailing list