Original Post
My application needs to load data from a text file and create a tree structure. Here is a simple example xml file:
.
It works. It''s not exactly fast but was good enough to get my by...
Questions:
-Passing in attributes like this is slow and ugly. I can''t think of anything better besides just passing in some pointers and forcing each class to scan the attribute array for attributes it knows about. Which is probably slower than building a map for each object anyway...
-Is this even a good mechanism? Can you think of a better way of turning XML data in to objects with settings.
(NOTE : I''ve just started looking in to using Xerces rather than Expat listed above.)
Many thanks,
Chris Brodie
http:\\fourth.flipcode.com
<form Name=Empty" Position="60 100" Dimensions="600 400">(Yes the coordinate system up upside down) What I currently do is use Expat to parse the file and create an object from each element. I then collect the attributes from each element and pass them to a member of the base object class ''SetAttributes'' which will configure the object based on the attributes of the element. SetAttributes receives a ref to a map