Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

creating separate xml documents

 
vanita maram
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a big xml document which contains 67 individual documents of the same kind. I need to break this big xml into individual documents and save them as individual xml docs. I am new to Java and was wondering if there is a way to do this using Java.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

You could try to do this with String manipulation, but it's safer to parse the big doc, construct smaller ones in memory, then write them to disk. There are several good parsing options. I'd probably favor a DOM parser for this because it will have methods to easily copy or write out your individual documents. Scroll on down to the XML and Related forum and ask for introductory tips to parsing.

Hope that helps!
 
Destroy anything that stands in your way. Except this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!