Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > populating my object model from XMl file

Reply
Thread Tools

populating my object model from XMl file

 
 
enigma261@yahoo.com
Guest
Posts: n/a
 
      12-23-2004
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

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-23-2004


http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:


> 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/>

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
enigma261@yahoo.com
Guest
Posts: n/a
 
      12-23-2004
I am using C++
thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Java Model to Java Model without XML erinbot@gmail.com Java 1 10-06-2006 09:00 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Populating a combobox from an XML file Billy Smith Javascript 2 07-18-2005 07:38 PM
Populating a treeview contol from an xml file Jason Shohet ASP .Net Web Controls 3 07-22-2003 01:42 PM
Object Model for XML??? Philip Battle XML 2 07-19-2003 08:39 AM



Advertisments