473,394 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

populating my object model from XMl file

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

Jul 20 '05 #1
2 1643


en*******@yahoo.com 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/
Jul 20 '05 #2
I am using C++
thanks

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: R | last post by:
Hello everybody. I'm writing my own Content System in PHP5. I've written so far main classes for handling DB connections, XML, XForms and Sessions. But I've got problem with one thing - it's...
4
by: Davíð Þórisson | last post by:
Hi, when I was programmin ASP/JScript I had a very nice utilitiy which I got from MSDN (Script56.CHM). It's simply a help file but containing object orientiated documentation of all scripting...
3
by: jayfischer91 | last post by:
The method below belongs to a class. The method accepts a dropdownlist as a parameter. Is there any disadvantage to passing in the control and having this method populate it as opposed to passing...
1
by: msnews.microsoft.com | last post by:
I'd like to hear your thoughts on best methods for populating drop down list controls. I have states and countries drop down lists that don't change often, so naturally I "hard code" them in the...
15
by: randyr | last post by:
I am developing an asp.net app based on a previous asp application. in the asp applications global.asa file I had several <object id="id" runat="server" scope="scope" class="comclass"> tags for...
5
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a...
18
by: blueapricot416 | last post by:
I am on a team designing the front end of an Intranet application. The backend guys will be using JSP and AJAX-like functionality to make server requests that must dynamically change elements on a...
11
by: AZRebelCowgirl73 | last post by:
here is the instructiions I am to use Ask the user to input the number of effective cars in the shop (this number should be between 1 and 100, inclusively). In a loop, controlled by the inputted...
8
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.