• Post Reply Bookmark Topic Watch Topic
  • New Topic

XML Edior  RSS feed

 
renu richard
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.
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java 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: 21133
87
Chrome Eclipse IDE Java 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!