0

Hi Folks,

I am new to java programming. I have an xml file

<File>
<XMLFile>
 <Type = "TypesFirst">
  <myI>17</myInt>
  <myS>Type one</myS>
  <myD>3.14</myD>
  <myL>1212121</myL>
  <myC>D</myC>
 </Type>
</XMLFile>
<XMLFile> 
 <Type = "TypesSecond">
  <myI>17</myInt>
  <myS>Type two</myS>
  <myF>7.14</myF>
  <myL>121456</myL>
  <myC>D</myC>
 </Type>
</XMLFile>
</File>

So I have to deserialize this file in such a way that if the Type is "TypesFirst" it goes to Object1 otherwise it goes to "TypesSecond". So by the end of the parsing, I should have two objects viz. object 1 and object2 containing respective Types from XML file.

I have two classes Object1 and Object2 that contains respective datatypes.

How can it be done ?? Please HELP.

4
Contributors
3
Replies
15
Views
3 Years
Discussion Span
Last Post by anand01
0

use SAX(Simple API for XML) parser jar or STAX(Simple streaming API for XML) parser jar to convert xml in to java objects

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.