473,804 Members | 3,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SubLi st.Sub.Type zzzz
..Tom.Ref.SubLi st.Sub.Type tttt
..Tom.Ref.VarLi st.Var.Type kkkk
..Tom.Ref.VarLi st.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 1659


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.SubLis t.Sub.Type zzzz
.Tom.Ref.SubLis t.Sub.Type tttt
.Tom.Ref.VarLis t.Var.Type kkkk
.Tom.Ref.VarLis t.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
2435
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 not even relative with implementation - I'm looking for a smart solution My present system works like this:
4
7060
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 languages. Very handy and easy to maneuver and quickly find information needed. Is there something similiar available for C#? At least some web page showing the object model of this language? thx!
3
1548
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 back a datareader from this method and having the webform populate it? It seems to work great! Just wondering if there may be a disadvantage to passing a control. Oh yea, by the way, it is just passing a pointer to the control, right? Or...
1
2493
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 aspx page. But the problem is these tend to really slow the development -- it takes up to 15 seconds for the page to come up in VS.NET design environment, so I'm thinking about taking these out and populating the controls dynamically using the...
15
2474
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 objects that the app used to speed up some global level data access and functionality. I have recoded the class libraries in .net and would like to acomplish the same functionality in asp.net.
5
2292
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 collection object -- say, a dictionary. Populating that collection object with custom objects, say, Person. What I really want to see is how to populate the properties of those Person objects from a datasource: instantiate one Person, fill...
18
3984
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 page. What is the best way to create and populate tables, which will exist in floating DIVs (with drag and drop capability)? It only has to work with IE6. I know of two ways:
11
2466
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 number of effective cars, ask the user to input each car data (i.e. make, model, year and price). You can assume that all input data is correct and no data validation is necessary. As soon as all input data for a car is entered, build a Car object by...
8
3092
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 reflect the values they anticipate committing to see hypothetical totals of columns from a set of records. These records are displaying properly on my DataGrid but I'm not sure how to get Crystal Reports 10 to use as its datasource the dataset...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.