populating my object model from XMl file

enigma261

Usenet Archive
Joined
Dec 23, 2004
Messages
6
Reaction score
0
Hi,

I am a XML beginner.
I need some guidance in intrepreting a XML file
and then populating my object model.

Following is an example of the XML file ..

<Tom>
<Version>x.0</Version>
<Ref>
<Id>5555</Id>
<SubList>
<Sub>
<Type>zzzz</Type>
</Sub>
<Sub>
<Type>tttt</Type>
</Sub>
</SubList>
<VarList>
<Var>
<Type>kkkk</Type>
</Var>
<Var>
<Type>mmmm</Type>
</Var>
</VarList>
</Ref>
</Tom>

After, I parse this file, I end up with a name-value pair, that looks like following

..Tom.Version x.0
..Tom.Ref.Id 5555
..Tom.Ref.SubList.Sub.Type zzzz
..Tom.Ref.SubList.Sub.Type tttt
..Tom.Ref.VarList.Var.Type kkkk
..Tom.Ref.VarList.Var.Type mmmm

After I have this name-value pair, I would like to populate my object model, which looks something like following

There is a class called "Tom" that has a property called "Version". "Tom" has a pointer to another class called "Ref" which in turn has a property called "Id". "Ref" also holds two lists each holding pointers to "Sub" and "Var".

This is just an example. But the general model is very similar.

I need some guidance in populating my object model after I have the name-value pair. ( At this point, I don't think it is really an XMl issue). Any other better way would also be highyl appreciated.

thanks
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
I need some guidance in intrepreting a XML file
and then populating my object model.

Following is an example of the XML file ..

<Tom>
<Version>x.0</Version>
<Ref>
<Id>5555</Id>
<SubList>
<Sub>
<Type>zzzz</Type>
</Sub>
<Sub>
<Type>tttt</Type>
</Sub>
</SubList>
<VarList>
<Var>
<Type>kkkk</Type>
</Var>
<Var>
<Type>mmmm</Type>
</Var>
</VarList>
</Ref>
</Tom>

After, I parse this file, I end up with a name-value pair, that looks like following

.Tom.Version x.0
.Tom.Ref.Id 5555
.Tom.Ref.SubList.Sub.Type zzzz
.Tom.Ref.SubList.Sub.Type tttt
.Tom.Ref.VarList.Var.Type kkkk
.Tom.Ref.VarList.Var.Type mmmm

After I have this name-value pair, I would like to populate my object model, which looks something like following

There is a class called "Tom" that has a property called "Version". "Tom" has a pointer to another class called "Ref" which in turn has a property called "Id". "Ref" also holds two lists each holding pointers to "Sub" and "Var".

This is just an example. But the general model is very similar.

You haven't told us which language you are using, for Java you might want to look into XMLBeans:
<http://xmlbeans.apache.org/>
 

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
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top