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

Need Help deserializing Binary Field in C++

Hi All -

I am creating a upgrade utility that transfers an bin / exe image over an
xml stream. But I can not seem to get the deserialization of the binary
field to work correctly. What I have is a base 64 encoded field but when I
try to deserialize, I throw an XML / reflection exception. However, if I
remove the base64 (m_Data) stuff everything works fine. I clearly have a
problem with my m_Data set-up. Does anybody know how to do this? What are
the corrrect data type and attributes?

String* xmlstr = "<?xml
version=\"1.0\"?><VersionMap><Packages><Firmware>< Description>Firmware Ver

// DESERIALIZE HERE (Host::Utils::Xml::Deserialize is my serialization /
deserialization wrapper - I think this works correctly)
MVersionMap* VersionMap =
dynamic_cast<MVersionMap*>(Host::Utils::Xml::Deser ialize(xmlstr,

//MIB Class
public __gc class MMib
: m_Size (0)
[XmlElement(DataType="unsignedInt", ElementName=S"Size", Namespace=S"",
Form=Schema::XmlSchemaForm::Unqualified, IsNullable=false)]
UInt32 m_Size;

// Firmware Class
public __gc class MFirmware
: m_Description (S"")
, m_ID (0)
, m_Size (0)
, m_Signature (S"")
, m_Mib (NULL)
[XmlElement(DataType="string", ElementName=S"Description", Namespace=S"",
Form=Schema::XmlSchemaForm::Unqualified, IsNullable=false)]
String* m_Description;
[XmlElement(DataType="unsignedInt", ElementName=S"ID", Namespace=S"",
Form=Schema::XmlSchemaForm::Unqualified, IsNullable=false)]
UInt32 m_ID;
[XmlElement(DataType="unsignedInt", ElementName=S"Size", Namespace=S"",
Form=Schema::XmlSchemaForm::Unqualified, IsNullable=false)]
UInt32 m_Size;
[XmlElement(DataType="string", ElementName=S"Signature", Namespace=S"",
Form=Schema::XmlSchemaForm::Unqualified, IsNullable=false)]
String* m_Signature;
[XmlElement(DataType = S"base64Binary", ElementName=S"Data", Namespace=S"",
Form=Schema::XmlSchemaForm::Unqualified, IsNullable=false)]
Byte m_Data[];
//[XmlArrayAttribute(Form=Schema::XmlSchemaForm::Unqu alified)]
//[XmlArrayItemAttribute(ElementName=S"Data",Form=Sch ema::XmlSchemaForm::Unqualified,
//char* m_Data;
//[XmlArray(ElementName=S"Data", DataType="base64Binary",
//[XmlArrayItemAttribute(ElementName=S"Data",Form=Sch ema::XmlSchemaForm::Unqualified,
// [XmlArrayItemAttribute(__typeof(Byte[]), DataType="hexBinary",
ElementName=S"Data",Form=Schema::XmlSchemaForm::Un qualified,
// Byte m_Data __gc[];
[XmlElement(__typeof(MMib),ElementName=S"MIB",Names pace=S"",Form=Schema::XmlSchemaForm::Unqualified,I sNullable=false)]
MMib* m_Mib;
Thanks for the Help!
Aug 17 '06 #1
0 1410

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

Similar topics

by: Wayne Wengert | last post by:
Using VB.NET I want to read in an XML file that has an array of objects and then step through the resulting array in code. I build a class to define the structure and I am running code to read in...
by: Andrew G. J. Fung | last post by:
Can anyone please explain to me why the code below throws an exception? It seems to occur when deserializing an instance of a subclass, whose base class holds a struct, where said struct holds an...
by: Earl Teigrob | last post by:
I am saving and restoring value types such as Int32, DateTime and Boolean in strings. I was wondering if there is a mechanism build into .NET for serializing and deserializing these to string...
by: Daniel Gackle | last post by:
I'm getting a strange ArgumentNullException after deserializing a SortedList. Haven't seen this discussed in the newsgroups, but it looks like a bug - unless I missed something obvious? I've...
by: Steve Teeples | last post by:
I use serialization to write class data to a file. During my development of this class I need to add properties or fields on occation. After adding a property, when deserializing the data saved...
by: ce | last post by:
Being a newbie regarding serialization and memorystreams, I was trying to see if i could improve page performance (avoiding going to the db on a postback) by saving my serialized business object in...
by: Chris Newby | last post by:
Given: public class MyClass{ public String MyPropertyOne; } I have a soap document created by serializing an instance of a previous version of MyClass. However, now MyClass looks like: ...
by: georges the man | last post by:
hey guys, i ve been posting for the last week trying to understand some stuff about c and reading but unfortunaly i couldnt do this. i have to write the following code. this will be the last...
by: shapper | last post by:
Hello, Consider I have a String: Dim MyString As String = "Hello" or an Integer: Dim MyInteger As Integer = 100
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...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.