Results 1 to 4 of 4

Thread: Need help creating a comprehensive tree using JDOM from an XML doc!

  1. #1
    Senior Member
    Join Date
    Feb 2005
    Location
    Folsom, CA
    Posts
    221
    Thanks
    0
    Thanked
    0 times in 0 posts

    Need help creating a comprehensive tree using JDOM from an XML doc!

    Well the title should say it all. I have been able to parse a not so fancy tree form a well formed XML document. I was using the JDOM api since I read that it is brand new, fast, open source and meshes way better with Java than the old DOM. Anyone have experience with this kind of thing? Basically what I am trying to do is to represent a complete XML document in the form of atree with the nodes being the tags and the leaves being either the elements or the attributes of each tag. I was also going to make it possible to edit the tree and then correspondingly show the changes in the XML document that is open in the application. I just kind of wanted some pointers from someone who has worked with and extended the DefaultMutableTreeNode and the TreeModel classes. Some pointers is all. Much appreciated. Thanks.

  2. #2
    Sam
    Sam is offline
    Registered+
    Join Date
    Oct 2003
    Posts
    22
    Thanks
    0
    Thanked
    0 times in 0 posts
    I'm confused. You're using JDOM but I don't know exactly what you want to do with your XML files?

  3. #3
    Senior Member
    Join Date
    Feb 2005
    Location
    Folsom, CA
    Posts
    221
    Thanks
    0
    Thanked
    0 times in 0 posts
    Haha sorry. I am a noob with using the JDOM api. I wanted to create a comprehensive JTree from my XML document using the JDOM api. I just dont know how to go about it. I have a preliminary JTree and while it shows each node as the tags of the xml document, I cannot retrieve more information about the elements and the attributes and values inside the tags themselves. So if for a moment you imagine a JTree with a whole bunch of nodes representing the tags of the xml document, when you expand a node you will see probably some leaf nodes, and these would be representing the elements and attributes and so on asssociated with that particular tag. So whether I have to implement certain features of the JDOM api or I have to create a new TreeModel class by extending it or so on I am not quite sure. Hope this helps.

  4. #4
    Sam
    Sam is offline
    Registered+
    Join Date
    Oct 2003
    Posts
    22
    Thanks
    0
    Thanked
    0 times in 0 posts
    Oh a JTree. I thought you wanted to have your own tree structure representing the XML data as the basis for your own processor.

    Anyway I never use swing so can't help.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •