Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2010
    Posts
    16
    Rep Power
    0

    Default how to split large xml file into small xml file in java

    hiii
    i have xml file of size 5mb and i want to split this file into number of file of each size is 20kb so please tell me how can i do this in java

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    i would guess because we nee the xml file to be well formed still ? that we would want to parse the xml file looking for the start and end tags , and perhaps after reading so many tags, cause the file to be saved and create a new file to write to at the end of the next tag.

    The reader might use something such as the StAX API. And the actual implementation depends on how your XML is structured and how you plan to read back in the split XML files. You might have to invent a new top level xml root tag in each split file to not cause the XML document structure to be broke. This would have to be parsed out (ignored) when reading each of the split pieces later.

    If you plan on re-assembling all of the pieces before trying to parse each XML file on its own then you might be able to just use simple line based splitting, which attempts to split the file after the given number of bytes or lines has been read, irrespective of the if it is at the natural end tag.

  3. #3
    munish is offline Member
    Join Date
    Jul 2009
    Posts
    37
    Rep Power
    0

    Default

    vijay mama hale tak tanu pata nahi lageya kive kare de aa file split mainframe programmer

Similar Threads

  1. post of large xml file on third party webservices
    By enggvijaysingh@gmail.com in forum XML
    Replies: 6
    Last Post: 11-16-2010, 04:03 PM
  2. Split wav file
    By evan_earnest in forum New To Java
    Replies: 7
    Last Post: 01-24-2010, 06:32 AM
  3. How to split a file into 2?
    By syntrax in forum New To Java
    Replies: 3
    Last Post: 09-26-2009, 07:28 AM
  4. Replies: 0
    Last Post: 04-25-2009, 11:18 PM
  5. how to split a file
    By nagaraaju in forum New To Java
    Replies: 0
    Last Post: 03-14-2008, 09:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •