Actually I'm implementing something and know one solution, but want to implement the

Joined
May 5, 2009
Messages
1
Reaction score
0
I have to implement SAX parsing on one xml. In SAX parsing, parser reads XML line by line. So it can look ahead. Now here is my XML structure(Note: Capital letters represent "ELEMENT" and small letters represent some value or attribute).

<xml>
<ELEMENT_A_COMPLEX>
<ELEMENT_B_STR>abc</ELEMENT_B_STR>
<ELEMENT_C_STR>abc</ELEMENT_C_STR>
<ELEMENT_D_COMPLEX>
<ELEMENT_B_STR>abc</ELEMENT_B_STR>
<ELEMENT_C_STR>abc</ELEMENT_C_STR>
<ELEMENT_A_COMPLEX>.......</ELEMENT_A_COMPLEX>
<ELEMENT_A_COMPLEX>.......</ELEMENT_A_COMPLEX>
<ELEMENT_D_COMPLEX>........</ELEMENT_D_COMPLEX>
</ELEMENT_D_COMPLEX>
</ELEMENT_A_COMPLEX>
</xml>

as you can see A and D are complex types. I have Classes for them. But they can contain object of type A,D again. So this will be nested tree depending upon XML. Now I want to create a general code which process this xml and create necessary tree with SAX implementation. Right now i'm maintaining an object which contains this,parent and child object and using Reflection API. Is there any better way to implement. Please suggest.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top