• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

XML Edior

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I wanna develop XML editor tool. Which does functions like parsing and giving the value if i give the node name. Can you please give me any URL or refer to some useful sites where i can get much more information on how to do this. Thanks.
 
Sheriff
Posts: 22818
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've created an XML viewer (no editing possible) using JDOM. That could be your first step too.
 
renu richard
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob,
It would be great help, if you could share the code or share some ideas with me, so that i could get some ideas on how to proceed with this. Thanks
 
Rob Spoor
Sheriff
Posts: 22818
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you checked out JDOM already? Check out the org.jdom.input.SAXBuilder for ways to create a Document from an existing source. You can then get your root element.

Since my setup had no requirement of changing XML nodes, I just subclassed DefaultMutableTreeNode:

(GPL'ed )
As you see, the constructor creates the entire sub tree, so you only need to call the constructor yourself for the root node.

However, since you will be editing, you may choose to go for a custom TreeModel instead. The following is an example of how you could do it:

If you modify your DOM tree, don't forget to fire events for the TreeModelListeners though. Just look at the source of DefaultTreeModel (available in src.zip) at how to fire events. fireTreeNodesInserted is one of the event firing methods.
 
reply
    Bookmark Topic Watch Topic
  • New Topic