accessing parsed data outside startelement function
hi , i m using JAXP and SAX to parse and XMl document
The problem is when lets say a class defined by me extends the default handler class to override start element and end element...
now as soon as i counter a particular type start element lets say 'x' i want it to be stored in an array of objects whose data members are attributes of 'x'.. but i instantiate an object only when the qualifiedname.equals(x);
so tht means that it gets instantiated only inside the if block.. n it throws nullpointerexception if i use it outside it.. but i want to use tht outside tht if block ..any suggestions pls help ..
p[i] =new Process();
System.out.println("name "+p[i].getProcessName() );//works fine
//System.out.println("name "+p[i].getProcessName() );//throws exception
i understand tht this shd necessarily throw exception.. i will like to knw a workaround for this thanks :)