Link to home
Get AccessLog in
Avatar of chand pb
chand pbFlag for United States of America

asked on

How to parse an xml string in Java

Hello,
 How can parse the XML string in java so that i get an arraylist...

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<Candidate>
      <EMPLID>1</EMPLID>
</Candidate>
<Candidate>
     <EMPLID>2</EMPLID>
</Candidate>
<Candidate>
     <EMPLID>3</EMPLID>
</Candidate>

Open in new window


I would like

arraylist[0] =
   <Candidate>
      <EMPLID>1</EMPLID>
</Candidate>

arraylist[1] =
  <Candidate>
      <EMPLID>2</EMPLID>
</Candidate>

arraylist[2]=
  <Candidate>
      <EMPLID>2</EMPLID>
</Candidate>

Thanks
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

That's not actually xml - at least not well-formed xml. There is no root element
ASKER CERTIFIED SOLUTION
Avatar of Jim Cakalic
Jim Cakalic
Flag of United States of America image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
And i hope you haven't had to follow that suggestion, as you should have proper xml ;)