JDOM - Variable not intialized error, why? please help.

Hello,

Please assit me.....I need a rush help. Stuck! Stuck!!!!

I am reading a text file which has multiple headers(identified in the first 2 pos as '//'), followed by '01' records which are details. It would look like

//nbr....

01address....

01city.....

01zip....

//name...(continues).

My jave routine reads it and puts the tags as

<efldata>

<tx>

<loadmessage>jhdfj

<nodedetail>

<address>....

<zip>

<nodedetail>

djfgkdf..... etc.

While compiling it gives me a loadmessage not initialized error. Please help. I have included arrow marks where the error occurs....

This is my code.....

while ((str = br.readLine()) != null) {

try {

String type = str.substring(0,2);

if ( "//".equals( type ) )

{

/**** header data ******/

hdr_count = hdr_count + 1;

controlnbr = str.substring(2,9);

f_first = 'y';/**** first time header check flag ***/

} else

if ( "01".equals( type ) )/**** Checks for detail records ****/

{

// loadmessage = new Element("LoadMessage");

if ((f_first) == 'y') { /*** Execute if first time(header) ***/

f_first = 'n';

Element tx = new Element("TX");

efldata.addContent(tx);

loadmessage = new Element("LoadMessage");

loadmessage.addAttribute(new Attribute("clientControlNo", controlnbr));

// loadmessage.setContent(null);

tx.addContent(loadmessage);

}

/*** Detail info ***/

dtl_count = dtl_count + 1;

String stopoffsequence = str.substring(2,4);

String nodecode = str.substring(4,24);

String addr1 = str.substring(24,60);

String bol = str.substring(147,154);

String year = str.substring(192,196);

Element nodedetail = new Element("NodeDetail");

nodedetail.addAttribute("seqInRoute", stopoffsequence);

// nodedetail.setContent(null);

Element nodeaddress = new Element("NodeAddress");

nodeaddress.addAttribute("address1", addr1);

Element nodeaction = new Element("NodeAction"); //.setContent(null);

nodeaction.addAttribute("bol", bol);

Element nodeactiondate = new Element("NodeActionDate");

nodeactiondate.addAttribute("year", year);

-->loadmessage.addChild(nodedetail);

nodedetail.addChild(nodeaddress);

nodedetail.addChild(nodeaction);

nodeaction.addChild(nodeactiondate);

}

}

[2583 byte] By [neelimap] at [2007-9-26 2:20:54]
# 1
Somebody, please help!!!!!!!
neelimap at 2007-6-29 9:25:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
No Java pro in here to help me?
neelimap at 2007-6-29 9:25:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Try Element loadmessage= new Element()CheersSanjay
san_gomes at 2007-6-29 9:25:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...