1 Reply Latest reply: Jul 25, 2013 9:30 AM by Darryl Burke RSS

    read xml files and write to the txt file

    user302148

      Hi,

      My background is mainframe and i'm new to java. We're moving from mainframe to the java world and i'm trying to

       

      achieve a task. I have a main folder and then bunch of sub folders and each sub folder has bunch of xml files, files

       

      size are varies some of them are 900kb. I need to read these xml files and send the output to the txt file (comma

       

      separated). I would really appreciate if someone can put me on the right track and advise me some possible options or

       

      even sample example would be great. please find below the sample xml file. I need to extract information's only where

       

      FORM name="F00001".

       

      [CODE]<PACKET>

         <FORM name="F00001" sequence="0">

            <FIELD sequence="1">02</FIELD>

            <FIELD sequence="2">00000</FIELD>

            <FIELD sequence="3">CAB100</FIELD>

            <FIELD sequence="4">TEFAP001</FIELD>

            <FIELD sequence="5">EMPTY FIELD</FIELD>

            <FIELD sequence="6">009.999.989</FIELD>

            <FIELD sequence="7">03</FIELD>

            <FIELD sequence="8">P9999999999999</FIELD>

            <FIELD sequence="9">EMPTY FIELD</FIELD>

            <FIELD sequence="10">EMPTY FIELD</FIELD>

         </FORM>

         <FORM name="F99999" sequence="1"

            <FIELD sequence="1">TIM K.</FIELD>

            <FIELD sequence="2">PROFESSOR</FIELD>

            <FIELD sequence="3">DAVID P. PIT</FIELD>

            <FIELD sequence="4">ASST PROFESSOR</FIELD>

            <FIELD sequence="5">EMPTY FIELD</FIELD>

            <FIELD sequence="6">009.999.989</FIELD>

            <FIELD sequence="7">03</FIELD>

            <FIELD sequence="8">P9999999999999</FIELD>

            <FIELD sequence="9">EMPTY FIELD</FIELD>

            <FIELD sequence="10">EMPTY FIELD</FIELD>

         </FORM>

      </PACKET>

      <PACKET>

         <FORM name="F00001" sequence="0">

            <FIELD sequence="1">09</FIELD>

            <FIELD sequence="2">00999</FIELD>

            <FIELD sequence="3">CAB101</FIELD>

            <FIELD sequence="4">TEFAP9999</FIELD>

            <FIELD sequence="5">EMPTY FIELD</FIELD>

            <FIELD sequence="6">009.999.999</FIELD>

            <FIELD sequence="7">03</FIELD>

            <FIELD sequence="8">T9999999999999</FIELD>

            <FIELD sequence="9">EMPTY FIELD</FIELD>

            <FIELD sequence="10">EMPTY FIELD</FIELD>

         </FORM>

         <FORM name="F99998" sequence="1"

            <FIELD sequence="1">KIM T.</FIELD>

            <FIELD sequence="2">PROFESSOR</FIELD>

            <FIELD sequence="3">NATHAN B.</FIELD>

            <FIELD sequence="4">ASST PROFESSOR</FIELD>

            <FIELD sequence="5">EMPTY FIELD</FIELD>

            <FIELD sequence="6">009.999.989</FIELD>

            <FIELD sequence="7">08</FIELD>

            <FIELD sequence="8">P9999999999988</FIELD>

            <FIELD sequence="9">EMPTY FIELD</FIELD>

            <FIELD sequence="10">EMPTY FIELD</FIELD>

         </FORM>

      </PACKET>[/CODE]

       

      Thank you so much

       

      best regards

      rm