<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">In my program I’m quiring the database for an activity then check the array of activities activity[6] if the activity exist in the array, if it does exist I then copy the activity into another array new_activity[6]. If the activity value already exist in the new_activity array I don’t copy the value.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">Now I need to create an XML doc using the values in the new_activity array with the outcome like the following.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><ActivitySummary></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1"> </SPAN><Activity> Training </Activity></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1"> </SPAN><Activity>Certification</Activity></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"></ActivitySummary></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT face="Times New Roman"> </FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">Here’s my code</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">String actType = activity.getChild("Activity").getText();<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">String[] activity = <SPAN style="mso-spacerun: yes"> </SPAN>{"Training", "RPL","Assessment", "Certification","CPD","EEP" };</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">String <SPAN style="mso-spacerun: yes"> </SPAN>new_activity[] = new String[6];</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">for(int i = 0; I < activity.length; i++){</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>if(actType ==activity[i]){</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1"> </SPAN>if(actType!= new_activity[i]){</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2"> </SPAN>new_activity[i] = actType;</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1"> </SPAN>}</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>}</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>if(act[a]!=null){<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>Element activityS = new Element("ActivitySummary");<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>Element activityT = new Element("Activity");<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>activityT.setText(new_activity[i]);<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-spacerun: yes"> </SPAN>activityS.addContent(activityT);<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>XMLOutputter outputter = new XMLOutputter();<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>outputter.output(activityS, System.out);<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>}<SPAN style="mso-tab-count: 1"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">}</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">The result I get are as follows</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><EM><ActivitySummary></EM></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><EM><SPAN style="mso-tab-count: 1"> </SPAN><Activity> Training </Activity></EM></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><EM></ActivitySummary></EM></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><EM><ActivitySummary></EM></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><EM><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN><Activity>Certification</Activity></EM></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><EM></ActivitySummary></EM></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">How will I create this Activity element in a way that they’ll are multiple <SPAN style="mso-spacerun: yes"> </SPAN>element to the ActivitySummary element.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">Best Regards</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></P>
<P> </P><p><hr SIZE=1>
Do you Yahoo!?<br>
Yahoo! Hotjobs: <a href="http://pa.yahoo.com/*http://us.rd.yahoo.com/hotjobs/mail_footer_email/evt=21482/*http://hotjobs.sweepstakes.yahoo.com/signingbonus">Enter the "Signing Bonus" Sweepstakes</a>