- Forums
- Forum Help
- Search Forum
- Login
- Register
Truevision3D
>>
Game Development
>>
Game Development
(Moderators:
Waterman
,
Mithrandir_
,
beyonder
,
ZaPPZion
) >>
XML Serialization/Deserialization
Pages: [
1
]
« previous
next »
Print
Author
Topic: XML Serialization/Deserialization (Read 1675 times)
serial
Customers
Community Member
Posts: 380
XML Serialization/Deserialization
«
on:
September 26, 2010, 06:31:30 PM »
Well I've been working on XML serialization for my game objects. It is all working fine but one question has popped up that I can't seem to google the anwser to.
How can I find out what type of object/class has been saved to the xml file? For example I have two classes Cat and Dog. I have a file for Dogs and a File for Cats. I want to be able to load the XML file without first knowing if it is a cat or dog file.
All of the examples that I can find predetermine the type of object it is going to be in the loading functions.
Logged
Mithrandir
Community Member
Posts: 325
Re: XML Serialization/Deserialization
«
Reply #1 on:
September 26, 2010, 08:15:06 PM »
You could read the XML file and check for cat or dog elements before deserializing.
Logged
ZaPPZion
Moderator
Community Member
Posts: 555
Re: XML Serialization/Deserialization
«
Reply #2 on:
September 27, 2010, 04:39:28 AM »
Or use inheritance to have both the cat and dog be an animal, load the animal, it will then be of the valid type, you can then determine which of the two it is by using reflection
Logged
Check out my website:
www.bartkuipers.com
serial
Customers
Community Member
Posts: 380
Re: XML Serialization/Deserialization
«
Reply #3 on:
September 28, 2010, 02:45:14 AM »
Both of those ideas did cross my mind. Will have to try them.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Truevision3D Official Information
-----------------------------
=> Development Information
-----------------------------
TV3D SDK
-----------------------------
=> TV3D SDK 6.3
===> Bugs
-----------------------------
Game Development
-----------------------------
=> Game Development
-----------------------------
Projects
-----------------------------
=> In-Development
=> Showcase
=> Recruitment
=> Announcements
-----------------------------
Truevision3D Official Information
-----------------------------
=> News and Announcements
-----------------------------
TV3D SDK
-----------------------------
=> TV3D SDK 6.5
-----------------------------
Game Development
-----------------------------
=> Engine Comparison
-----------------------------
TV3D SDK
-----------------------------
===> Shader Development
===> Content Pipeline
===> Bugs
-----------------------------
Game Development
-----------------------------
=> Companion Tools
=> Design and Theory
Powered by SMF 1.1.3
|
SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks