Hey,

<Member>
<Id>1002</Id>
<ColAffected1>Name</ColAffected1>
<Val1>Shyam</Val1>
<ColAffected2>Skills</ColAffected2>
<Val2>Cooking</Val2>
<Id>1003</Id>
<ColAffected1>Name</ColAffected1>
<Val1>Jack</Val1>
<ColAffected2>Skills</ColAffected2>
<Val2>PHP</Val2>
</Member>

I am reading this xml file and parsing the data ... Now I`m trying to put it 
into an avro data file (we`ll not exactly) trying to send it over the server 
using kafka ... 

But in the code below .. 



                Parser parse=new Parser();
                Schema schema=parse.parse(new 
File("/home/gjhawar/Desktop/memschema.avsc"));
                
                ByteArrayOutputStream bos=new ByteArrayOutputStream();
                Encoder e= EncoderFactory.get().binaryEncoder(bos, null);
                GenericRecord rec=new GenericData.Record(schema);
                GenericDatumWriter<GenericRecord> datumWriter = new 
GenericDatumWriter<GenericRecord>(schema);
                
                
                
                for(int i=0;i<memlist.size();i++)
                {
        
                rec.put("name", memlist.get(i).name);
                rec.put("skill", memlist.get(i).skill);
                datumWriter.write(rec, e);
                
                }
                
                e.flush();
                System.out.println(bos.toString());
                
Only SHYAM is getting out after the print statement .. I tried everything but I 
am not getting the error.


Regards,
Gaurang Jhawar
USC
www.linkedin.com/pub/gaurang-jhawar/63/a24/6a6/

Reply via email to