473,322 Members | 1,610 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,322 software developers and data experts.

can this C++ xml serialization be de-serialized into C# classes?

BeemerBiker
I have a (fairly simple?) xml file that was created (serialized I assume) by a C++ program. I am trying to deserialize it with my C# program so I can analyze it. I cannot arrange my C# classes so as to properly deserialize all the parts of the xml file. I assume that some C++ class layouts cannot be duplicated in C# and that is the problem. I have easily walked thru the tree and converted the xml data into my own class structure, but I am learning to use serialization and wanted to give that a try as it is cleaner. The basic problem is that I cannot arrange 10 "Stacks" of list boxes, one new "Deck" a list box and one "Completed" list box under 12 "CardStack" classes. They all have to fit under "CardStacks" and that fits under "CardTable". The list boxes all have identical structure so Deck is no different than Completed nor Stacks. The best I can do is to read all the "Stacks" but I cannot retrieve the "Deck" nor the "Completed" with below code
Expand|Select|Wrap|Line Numbers
  1.     [Serializable]
  2.     public class CardStacks
  3.     {
  4.         public CardStack[] CardStack = new CardStack[10];
  5.         public CardStack Deck = new CardStack();
  6.         public CardStack Completed = new CardStack();
  7.         public CardStacks()
  8.         {
  9.             for (int i = 0; i < 10; i++)
  10.                 CardStack[i] = new CardStack();
  11.         }
  12.     } 
  13.     [Serializable]
  14.     public class CardTable
  15.     {
  16.         public CardStacks CardStacks = new CardStacks();
  17.     }
Each of the above 3 "CardStack" are the identical class so I would have thought that there would be a total 12 of them in the resulting xml file. Instead there are only 10 and one each of "Deck" and "Completed" which are missing the wrapper "CardStack" about them as shown in the attachment "test.xml" Is it possible to wrap "Deck" and "Completed" with the class "CardStack" ? If so, that would solve my de-serialization problem.

Thanks for looking!
Attached Files
File Type: zip sample_xml.zip (3.6 KB, 70 views)
Sep 13 '10 #1
0 952

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Gavin | last post by:
Hi, I'm using the BinaryFormatter so serialize a document class hierachy to a file. I'm using rather large files (20-50mb) so I was wondering if anyone knows of a way to check the progress of the...
2
by: reycri | last post by:
I have a .Net class (a collection) that already supports serialization. It implements ISerializable... Now, I need it to also support the COM interface IPersistStream. Among other things, I need...
1
by: Dave Romig | last post by:
Can anyone provide guidance for saving and restoring an XMLDOM object as a binary blob? In a VB application, I need to repeatedly save and restore a large, dynamic XML document. Currently, the...
1
by: Rein Petersen | last post by:
Hi Everyone, I'm into serializing/deserializing a particular class I have created but I need to control the exact binary formatting. From what little information I can find on the subject, it...
5
by: Tamir Khason | last post by:
I have an object (eg MyObject with namespace eg MyNamespace) public class MyObject While I serialize it the XML created is <MyObject xmlns:xsd="http://www.w3.org/2001/XMLSchema"...
1
by: oDDskOOL | last post by:
I realized today that the Hashtable.Clone only produces a shallow copy... that makes me go mad that M$ doesn't even provide a deep copy ctor for the Hashtable class ! mighty tech ducks might...
0
by: MattB | last post by:
I have a dataset that originated as a string (passed from a C++ dll). I de-serialize it, use the data, and then in some cases I will serialize it again to pass as a session variable in my app and...
6
by: George M. Garner Jr. | last post by:
VC8.0 crashes while compiling boost-1.33.1 serialization library (or any other library that includes the serialization headers) if code analysis (/analyze) is enabled. This problem did not occur...
6
by: mookid8000 | last post by:
Hi group! Is it possible to scan an assembly *which has NOT been added as a reference* for types, and dynamically create instances of the loaded types? I have a program, MyProgram.exe, which...
0
by: mshetty | last post by:
Hi, Is it possible to override the default de-serialization of parameters sent to a Web Method written using SoapRpcMethod keyword? Thanks and Regards, M Shetty
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.