Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

XML Edior

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • 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: 21997
107
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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: 21997
107
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • 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.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic