aspose file tools*
The moose likes XML and Related Technologies and the fly likes Components of a DOM Handler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Components of a DOM Handler" Watch "Components of a DOM Handler" New topic
Author

Components of a DOM Handler

s ithu
Greenhorn

Joined: Apr 10, 2012
Posts: 11
HI guys ,
I am building a dom handler for handling xml file ,in core java .
I did the following methods
  • createxml :Create xml file from a database and save in local machine
  • parser method : give parser out put of xml file
  • Display:display xml file in a Jsp page as well as in IDE output terminal
  • Deletenode: delete node whose name is passed
  • insertnode: append a child node at the end of file
  • searchnode : search node whose name is passed and display its count

  • I have doubt in delete and insert methods.should i delete all nodes in the file or only first node?
    should i put provision to insert more child node?
    I do nt knw the requirements of the project.
    But I intend to build a standard Dom Handler so that it can be used in future also.
    John Jai
    Bartender

    Joined: May 31, 2011
    Posts: 1776
    I have only used a few of the org.w3c.dom methods -

    For deleting nodes the method I have used is http://docs.oracle.com/javase/6/docs/api/org/w3c/dom/Node.html removeChild() method that will remove the specified node. So you can have your implementation like the user has to specify the node to be deleted than you having logic of deleting all nodes or first node when calling delete node. If the user needs to delete more than one node, then he can call the delete node method in a loop.

    For inserting, there is http://docs.oracle.com/javase/6/docs/api/org/w3c/dom/Node.html appendChild() method that appends at the last http://docs.oracle.com/javase/6/docs/api/org/w3c/dom/Node.html insertBefore() that inserts before the specified node. Similarly if more than one node has to be inserted let the users call appendChild() method with the nodes that needs to be appended.

    May be other ranchers can help you better.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Components of a DOM Handler