Results 1 to 1 of 1
- 06-16-2010, 08:35 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 1
- Rep Power
- 0
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 ..
if(qualifiedName.equals("Process"))
{
p[i] =new Process();
p[i].setProcessName("testing");
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 :)
Similar Threads
-
Accessing Data From Websites in Java
By capitalistpig in forum New To JavaReplies: 13Last Post: 06-21-2010, 11:11 PM -
JNI accessing non primitive data type
By H_P in forum Advanced JavaReplies: 1Last Post: 04-14-2010, 06:43 AM -
Accessing Data from a .txt file
By Oasis13 in forum New To JavaReplies: 5Last Post: 02-01-2008, 01:16 AM -
Packaging and accessing data files
By todd in forum Advanced JavaReplies: 1Last Post: 08-01-2007, 01:27 AM -
Parsed Document
By nick211001 in forum New To JavaReplies: 1Last Post: 07-29-2007, 02:53 AM
Bookmarks