XML serialisation

Forum for posting problems using QxOrm library

XML serialisation

Postby ruddy32 » Thu Jan 06, 2011 8:41 am

Hi,
I would like to set an object using an XML stream with some missing object attributes. I get an error doing this.
Is it possible to do it using QxOrm 1.1.3?
Thanks
ruddy32
 

Re: XML serialisation

Postby ruddy32 » Thu Jan 06, 2011 9:06 am

This is done by settings the bSerialize flag to false in QxClass::add() method. Right?
ruddy32
 

Re: XML serialisation

Postby QxOrm admin » Thu Jan 06, 2011 2:32 pm

Hi,

If you want to serialize/deserialize an object without some attributes defined in your qx mapping function, you have to use this method :
template <typename V> IxDataMember * data(V T::* pData, const QString & sKey, long lVersion, bool bSerialize);

For example :
In the code below, when you serialize/deserialize an object of type CPerson, attributes "lastName" and "sex" are ignored by serialization process.

Code: Select all
namespace qx {
template <> void register_class(QxClass<qx::test::CPerson> & t)
{
   t.id(& qx::test::CPerson::m_lPersonId, "idPerson", 0);
   t.data(& qx::test::CPerson::m_sFirstName, "firstName", 0);
   t.data(& qx::test::CPerson::m_sLastName, "lastName", 0, false);
   t.data(& qx::test::CPerson::m_eSex, "sex", 0, false);
}}
QxOrm admin
 


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 10 guests