473,766 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is the best way to create C++ objects from parsed XML data?

**** Post for FREE via your newsreader at post.usenet.com ****

I'm working on a 3d engine system.
I need to save/load data in the systems objects to/from XML files.
When I say objects, I mean C++ objects. (These generally correspond to
scene objects, but that consideration isn't important as far as
loading/saving goes.)

I think I have a reasonable grasp of XML, it's method of data
representation, and parsing XML files.
(At the moment I'm looking at using the expat XML parser for it's
callback based system, so I don't have to load/parse the whole -
potentially v large - XML file into memory before I create objects).

The problem I'm having is deciding how to get the data from the XML
parser into the C++ objects.
How is this normally done?
Do you pass the completed/parsed XML node to the C++ object creator?
Do you create the object object and set it's members with data from
the completed/parsed XML node?

What's the best/most flexible way to do this, or are what are pros and
cons of various methods?
Pointers to some examples would be greatly appreciated.

Thanks

Jim Williams

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Jul 20 '05 #1
2 4411
Jim Williams <no****@nowhere .com> wrote in message news:<qo******* *************** **********@4ax. com>...
**** Post for FREE via your newsreader at post.usenet.com ****

I'm working on a 3d engine system.
I need to save/load data in the systems objects to/from XML files.
When I say objects, I mean C++ objects. (These generally correspond to
scene objects, but that consideration isn't important as far as
loading/saving goes.)

I think I have a reasonable grasp of XML, it's method of data
representation, and parsing XML files.
(At the moment I'm looking at using the expat XML parser for it's
callback based system, so I don't have to load/parse the whole -
potentially v large - XML file into memory before I create objects).

The problem I'm having is deciding how to get the data from the XML
parser into the C++ objects.
How is this normally done?
Do you pass the completed/parsed XML node to the C++ object creator?
Do you create the object object and set it's members with data from
the completed/parsed XML node? It depends on the message size. If it is too big, parse using the SAX
method, otherwise, you may use DOM.
What's the best/most flexible way to do this, or are what are pros and
cons of various methods?
Pointers to some examples would be greatly appreciated. http://xml.apache.org
Thanks

Jim Williams

You're welcome,
Fabien
Jul 20 '05 #2
"Jim Williams" <no****@nowhere .com> wrote in message
news:qo******** *************** *********@4ax.c om...
The problem I'm having is deciding how to get the data from the XML
parser into the C++ objects.
How is this normally done? Do you pass the completed/parsed XML node to the C++ object creator?
No. For one thing, I prefer to keep XML/DOM classes out of the declarations
(member and argument types) of my own C++ classes.
Do you create the object object and set it's members with data from
the completed/parsed XML node?


Yes that's the most common approach I've seen.

/kmc
Jul 20 '05 #3

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

Similar topics

12
3304
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. Such things happen. The whole subsystem is going through radical changes. I don't really want to say what I think of the code just yet. That would influence the opinions of others, and I really want to know how other people view these things,...
16
1827
by: sirsean | last post by:
Hi all. I'm trying to dynamically build menus and objects after my page loads. Data is stored in an XML file and is parsed at runtime into Javascript objects. At the moment, I'm working on creating menu items from these objects. The parsing works fine (using Sarissa), and Firefox builds the menu no problem. IE, however, does not. The functionality of the menu will be a single onclick event. It seems that Firefox allows me to set the...
21
13846
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered by Sets. - ICollection cannot decide containment - IList promises indexability by the natural numbers, which is not achievable (since i hash elements, not sort them). - IDictionary is definatly not setlike. Although I can, of course, define...
3
2055
by: Ben Becker | last post by:
I am trying to build a custom crosstab type of grid where I take some items in a data grid and based on the content of the current item compared to the previous item, determine if a new row in a table should be created or not. In order to do this, I need to have full control over the conditional logic for how items get displayed within a repeater element which I'm not seeing as possible. How can I cursor through a data set, apply...
8
3183
by: Midnight Java Junkie | last post by:
Dear Colleagues: I feel that the dumbest questions are those that are never asked. I have been given the opportunity to get into .NET. Our organization has a subscription with Microsoft that basically entitled to us to just about every .Net development tool you can imagine. I cant even begin to mention them. To begin with, my background is not that of a programmer, but a systems engineer and the closest I have come to "programming"...
4
1387
by: | last post by:
ASP.NET is a kind of "engine" that takes declarative markup and code and renders these instructions into presentational forms. And every page is a class. With that in mind I'm wondering, a) how to intercept the rendered output and do further programmatic things with it; and b) how coarse or finely grained the control might be. One could envision the
13
3114
by: Alan Silver | last post by:
Hello, MSDN (amongst other places) is full of helpful advice on ways to do data access, but they all seem geared to wards enterprise applications. Maybe I'm in a minority, but I don't have those sorts of clients. Mine are all small businesses whose sites will never reach those sorts of scales. I deal with businesses whose sites get maybe a few hundred visitors per day (some not even that much) and get no more than ten orders per day....
10
8813
by: Simon Brooke | last post by:
The DOM API has included public Node importNode(Node,boolean) as a method of the Document interface for a long time. Does anything actually implement it? Xerces 2 is giving me: org.w3c.dom.DOMException: NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation. at org.apache.xerces.dom.CoreDocumentImpl.importNode(Unknown Source) at org.apache.xerces.dom.CoreDocumentImpl.importNode(Unknown Source)
4
1530
by: trullock | last post by:
Hi, Can anyone suggest the best way to go about the following... I'm tracking clicks (mouse down x,y coordinates) on a web page by using some javascript to create an XHR which sends the coordinates to a recording service, such as: /Record.ashx?X=123&Y=456
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10168
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
10008
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...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7381
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
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
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...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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.