split multiple files from a single file in files(xml's) individual

Hello
I have a file (.txt) of newspaper which has all the inputs and output xmls as well as a few other details of the server log, I want to use it as an entry, and then to hold the input files required, say 50 xmls in the input message unique and 50 xmls of output messages that is unique to root element is the element root ignoring the unnecessary data.

as:
input and output xml will have the standard root as < input > elements < / input > and < output > < / output >.

Thank you.

Published by: user12679330 on May 15, 2013 22:52

Published by: user12679330 on May 15, 2013 22:53

Published by: user12679330 on May 15, 2013 22:53

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
to import java.io.FileNotFoundException;
to import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

import java.util.StringTokenizer;

public class ExtractXmls {}

Public Shared Sub main (String [] args) throws FileNotFoundException,
IOException {}

("String data = readFile("C:/MyFolder/DataFile.log ");
String startData ="<>

StringTokenizer stk = new StringTokenizer (data, startData);
int count = 0;
While (stk.hasMoreTokens ()) {}
String token = stk.nextToken ();
Count ++;
}
System.out.println (Count);
EndData string = "";
int start = data.indexOf (startData);
int end = data.indexOf (endData);
end = end + 5;
int i = 1;
While (i< 5000)="">
String fileData = data.substring (start, end);
System.out.println (BancsData);
data = data.substring (end);
Start = data.indexOf (startData);
end = data.indexOf (endData);
end = end + 5;
createFile (fileData, i);
i ++ ;
                 
}

}

private public static void createFile (String, int count data) {}
FileOutputStream fos;
try {}
FOS = new FileOutputStream ("C:/target/output/file" + count + ".xml");
BufferedWriter BW = new BufferedWriter (new OutputStreamWriter (fos));
BW. Write (Data);
bw.newLine ();
BW. Flush();
Count ++;
} catch (Exception e) {}
Generative TODO catch block
e.printStackTrace ();
}

}
     
private static String readFile (String path) {}
StringBuilder sb = new StringBuilder();
try {}
= New File (path);
FileInputStream fis = new FileInputStream (file);
Bis buffer = new BufferedInputStreamfis();
int = 0;
char inChar.
{}
in = bis.read ();
inChar = (char);
If (in! = - 1) {}
SB. Append (inChar);
}
} While ((dans! =-1));
bis. Close();
} catch (FileNotFoundException exception) e {}
e.printStackTrace ();
} catch (IOException ioe) {}
ioe.printStackTrace ();
}
Return sb.toString ();

}

}

Tags: Java

Similar Questions

  • Multiple distributions from a single source

    Hello world.  I am trying to use a source tree and two applications for the same device but slightly different brand.  I use the preprocessor CAP to change the source-based distribution with ant and Eclipse (with the bb Scion).  Most of the time I work.  The problem is when I'm simulating single app will work because they are fighting for the persistent store. I tried just renaming applications based on their brand, but that is just on the Simulator.

    The only solution I see is to use the preprocessor to conditionally to name the package. Is there another way like a magic jad? I must say that the Eclipse plugin is rapidly becoming usless for any real project.

    I found it easier to use the c preprocessor ++ but in all cases, you can use the single hashtable persistent with fixed guid and do another

    entry for each app. Alternatively, it might be better to simply define a symbol to be used as the guid po. I don't know what

    preprocessor Cap racks, but they have uses beyond variants of construction (#if RIM_OS_TGT > 40300) etc and I regularly

    Use __LINE__ in lieu of stack trace information and c ++ TIMESTAMP (IIRC, don't remember exactly) for the maintenance of the

    track builds.

  • HP Officejet Pro X476dw (nextworked-Windows 7 Pro) how to scan multiple pages into a single file?

    Does anyone know how to scan multiple pages into a single jpegfile?

    When you scan a document of several pages in a file on a network each page gets its own jpeg image scanend file.

    HP standalone scanner allow generally allows you to add the multuple scans in a jpeg file.

    Any help much appreciated!

    Thank you

    Joihn

    Hello

    Well, I don't know how you can read many jpeg files into a SINGLE file. Put scanned images in a folder is a logical way to keep them in one place. From my understanding single jpeg image may be a ONE page document, but many jpeg images cannot be concatinated to be a multiple page document. We can use images, software publishing to put them in a single document, but still only one page (each image is smaller). Using pdf output, you can concatenate/merge a lot of images in a sinlge multi-page file.

    Kind regards.

  • How to put multiple classes in a single file?

    Hello

    I would like to put multiple classes in a single file. (This would be useful for grouping children who are minor extensions of the parent classes or helper classes that are used by a class only).

    When I tried to combine two classes in a file, I got this error message:
    5006: an ActionScript file cannot have several definitions visible from the outside: Notation.editField, Notation.labelField1

    It is the structure I used. Thanks in advance for your help.

    You can declare multiple classes in a single file, but only one can be
    in the package declaration. All statements outside the package class
    are invisible to code outside the file.

    sample package
    {
    public class SampleClass
    {
    }
    }

    class SampleClassHelper
    {
    }
    class SampleClassHelper2
    {
    }

  • Manually to scan multiple Pages into a single PDF file.

    Gentlemen:

    My gear - 4620 HP all-in-One.

    Problem:

    I prefer to scan multiple pages into a single PDF file and save them on the hard drive manually.

    The ADF is twisting the pages that are saved in the PDF file.

    Please notify.  An upgrade of the software will be available for manual use set up of the

    pages on the glass?

    No other problems with the HP 4620.  I use Windows 7, 64 bit.

    Just reply to your convenience.

    PDF4ME

    PDF4ME,

    Watch it again once and document Scanning how-to - for Windows 7, I don't see that Preview Scan must be turned on to scan several pages.

    You can check again to see if you can get this works by following the instructions in the document.

    HP Officejet 4620 e-all-in-one printer support - scanning - Windows 7

    Click on the thumbs-up Bravo !

    It's a nice way of saying 'Thank you' for help.

    While I strive to reflect best practices of HP, I do not work for HP.

  • HP5610xi: Using a HP 5610xi, how can I scan multiple pages into a single file?

    Using a HP 5610xi, how can I scan multiple pages into a single file?

    Hello

    Thank you for using the HP Forums.

    Can try this software:

    HP extended Scan

    FTP://FTP.HP.com/pub/scanners/HPScanExt/HPScanExt.msi

    Once it has downloaded and installed, go to start > all programs > HP > HP Scan extended > Run "HP Scan extended.

    This relevant resource will show you how to scan multiple pages into a single file:

    HP Officejet Pro 6960 series: scan a document of 6 pages 2 sides using the ADF

    Let us know if it works!

  • HP Envy 4502: Scanning of multiple Documents in a single file on Mac OS 10.6/HP Envy 4502

    Can figure out how to scan multiple documents in a single file. I looked at the previous questions and answers, but I don't see a menu drop-down, click on when I select PDF. Have no idea how to proceed.

    Hi @JaneDeere,

    Welcome to the HP Forums!

    I noticed that you are trying to scan multiple documents in a single file on Mac OS 10.6/HP Envy 4502. I'm happy to discuss this issue for you!

    Please, try the steps in this guide, How to scan (OS X 10.6). Choose Scan with HP software, scroll and select, how to scan an original of several page in one file, and follow the instructions.

    I hope this is the answer you are looking for!

    "Please click the Thumbs up icon below to thank me for having responded."

  • Can I put multiple PDFs into a single pdf file?

    Original title:

    PDF to PDF

    Can I put multiple PDFs into a single pdf file?

    I have a lot of files that consists of 1 page. Is it possible so that I can put them together and print them out?

    Otherewise I have to press the button print 60 times.

    You will need a software to do this. If you haven't already, Google for «combining PDF» There are also sites that allow you to do this online.

  • How can I scan multiple pages into a single file using the PIXMA MG2100 printer?

    Does anyone know how to scan multiple pages into a single file, jpeg, pdf, or word?

    Thanks for any help

    Sandy

    So that the community can help you better, we need to know exactly what operating system is running on your computer.  This and all other details you want to give only will help the community better understand your question! Thank you and have a great day!

  • How to scan multiple documents into a single pdf file of ADF on my MX922?

    How to scan multiple documents into a single pdf file of ADF on my MX922?


  • Move multiple files from one folder to another in SkyDrive?

    How can I move multiple files from one folder to another in SkyDrive?  When I click on a file, & then use CTRL-click on another file, it moves to that one.  Can I select multiple files & copy or move or rename on PC?

    For now - not.  SkyDrive Wave5 or anyone should have this ability when it is fully released.

    http://www.LiveSide.NET/2011/09/06/SkyDrive-wave-5-to-finally-support-multiple-files-selection/

    (Read and also read comments on things, you might be able to use now to accomplish what you want).

  • How to open multiple files with the same extension in one program from the Explorer

    I frequently receive several JPG (or whatever extension) files to my clients.  On Windows XP, I could just highlight the files I want to open, and then click Open.  They would be so open to 1 program cascading.  This made it easy when comparing many images.  If I do the same thing in Windows 7, it opens the default program several times and puts 1 image of each open program.  It is Paint Shop Pro in my case.  Thus, instead of so-called images 5 open cascading in Paint Shop Pro... the computer open Paint Shop Pro 5 times with 1 image of each open version of the program.  I tried this search like crazy, but cannot find the right thread for an answer.  Most of the threads are on the opening of the different file types.  My question is only about the opening of multiple files with the same exact file inside 1 free program extension.

    Is this the same version of Paint Shop?

    One thing you might try is to open Paint Shop, then select and drag all the files in this window of the paint shop.  Various programs to manage this type of action differently from the DDE, but it might give you the expected results.

  • What is the less expensive software or the online application to create PDFs from multiple files?

    What is the less expensive software or the online application to create PDFs from multiple files?

    The service Pack PDF can be used from a web page or of the CD player. Adobe low cost subscription offering that does this. Online PDF converter, convert to web or Acrobat Reader | Adobe PDF Pack to convert things other than Office documents and images, you need the Acrobat application instead.

  • I can't have multiple files open at the same time! I need to compare the content from one to the other. How to display two files at the same time?

    I can't have multiple files open at the same time! I need to compare the content from one to the other. How to display two files at the same time?

    Hi sindres79946597,

    Open Acrobat Reader DC, navigate to the Edit-> Preferences-> General-> uncheck "Open Documents in the new tab in the same window.

    Now, reboot your system, when you open multiple PDFs that all will open in a new window so that you can easily compare.

    Kind regards
    Nicos

  • Should how Acrobat I buy to be able to convert multiple documents in a single pdf file?

    What adobe software, do I need to buy to be able to convert multiple documents in a single PDF file?

    Hi Manorani,

    The Pack of Adobe PDF allows to combine several files into a single PDF file. For more information, please visit cloud.acrobat.com.

    Best,

    Sara

Maybe you are looking for