Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xml from DOM

 
Bala Krishna
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read my xml document from a file, make some changes to it (like adding an attribute here, adding an element there etc.) using DOM. When I'm done with the changes, I want to get the changed xml from DOM. I looked at org.w3c.dom.* packages, but couldn't find a way to do it. Had to take google's help, and I've seen many people asking the same question (how do I get xml from DOM) in various forums. Finally, I stumbled upon the following code :



I tried it and it works. But, some how, I feel that it shouldn't be this complicated (albeit only a few lines of code), to get xml from DOM. Has any one else found a different/better solution to this problem?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic