• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to split a large xml file into smaller xml files ?

 
Tiya Khambadkone
Ranch Hand
Posts: 109
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to split a large xml file into smaller xml files ?

Either using xslt or xpath or any other method ?
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tiya,

Which parser you are goin to use? xpath can only use with dom.

Regards
jatan
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would consider using an SAX parser, simply writing the contents of events to a new file until it reached a good place to split. Then write the closing root element, close that file, open a new one, write the opening root element and continue copying.

Obviously you need to pay attention to the hierarchy and split only at a point that makes sense.

There may be a perfectly obvious way to do this with XSLT - not my field.

XPath has nothing to do with this problem.

Bill
 
Paul Clapham
Sheriff
Posts: 21155
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:There may be a perfectly obvious way to do this with XSLT


In XSLT 1.0 (which most people are still using) it's only possible to write a single document as output. XSLT 2.0 provides ways of writing several documents from a single transformation, but it isn't built into the standard Java API.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic