Results 1 to 20 of 31

Thread: Serialization Of Xml using QObjects

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    5

    Red face Serialization Of Xml using QObjects

    Dear Forums,


    I have a doubt regarding using XML serialization to generically serialize any ole QObject. This kinda perplexes me because all the needed elements appear to be within Qt. Qt has XML serialization classes and reflection through its meta data system, yet no XML serialization function that accepts a QObject.Please provide me with a specific solution...........Thanks in Advance......Any solution would be appreciable...............


    Regards,

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Wiki edits
    15

    Default Re: Serialization Of Xml using QObjects

    In general XML is used for information exchange, where you would typically serialize somthing (QObject) to send it across to some other party (or software etc). Now the important requirement is that both parties should agree on the XML schema of the serialized QObject. I think it is this lack of a standard of specifying the schema of the QObject is one main reason for not having such serialization API/function.

    Moreover it gets complicated for custom (derived QObjects) where the derivered QObject definition may not be always be inline with Qt Meta System. (I mean properties etc), may be this is another reason.

    Anyway it is possible to come up with a simple mechanism using a combination of one or more of the framework classes QDocDocument, QSetting, QVariant, QXmlStreamWriter, to write a custom XML serialization schema
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    5

    Red face Re: Serialization Of Xml using QObjects

    Dear Santosh,


    Thanks for the reply........Actually i dint understand the way you said ..........Can you give me an example so that it would be very favourable to understand for me..........Any solution would be appreciable.........Thanks in Advance........


    Regards,

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Wiki edits
    15

    Default Re: Serialization Of Xml using QObjects

    I meant that Qt already has enough support so that one can write serialization (XML or any other type) them selfs
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  5. #5
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    5

    Red face Re: Serialization Of Xml using QObjects

    Dear Santosh,


    Thanks for the reply..........Can you just me a sample program on how to do it pretty confused in writing it..............Any solution would be appreciable........Thanks in Advance........


    Regards,

  6. #6
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Wiki edits
    15

    Default Re: Serialization Of Xml using QObjects

    It depends, what do you want to do with the serialized XML data?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  7. #7
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    5

    Default Re: Serialization Of Xml using QObjects

    Dear Santosh,

    Thanks for the reply..........What i need is i have to hit the live database of our .net application so for that i need to serialize my data in the form of an object and then send it to hit the live db of our application...........Hope you got me..........Any solution would be appreciable.Thanks in advance........


    Regards,

  8. #8
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Wiki edits
    15

    Default Re: Serialization Of Xml using QObjects

    It is not clear to me.

    Who will read the DB (the Qt Applciation / .Net serialization API)?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  9. #9
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    5

    Default Re: Serialization Of Xml using QObjects

    Dear Santosh,

    I will explain in brief i have a device,In that Device database i save my transaction data ..I need to insert this data in server DB....so now i get my required data from Device db to transfer to server through QUERYING. For example i got 5 rows with 10 columns........now to insert this records in SERVER Database,I need to do serialization for these result and hit the web service with that serialized object to pass these data and get inserted in the SERVER Database....????
    ->Passing anything either xml/json serialization object has to been done, to hit web service .Hope you got me now...........Thanks in Advance.........Any Solution would be appreciable........


    Regards,

  10. #10
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Wiki edits
    15

    Default Re: Serialization Of Xml using QObjects

    Who do you think will read/get this serilaized data from server, and how will they understand the xml serialization scheme you used to serialize?

    I think i am completly off the page, or missed someting.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  11. #11
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    5

    Default Re: Serialization Of Xml using QObjects

    Dear Santosh,

    Thanks for the reply.........Actually we have an Service(Api) in the .net now what we are going to do is we serialize(Xml/Json) the data that we get from the Qt as an object say for example the object contains about more than 10 fields and send that to the server after serialization(Xml/Json)......In the Server through this Service it gets hit ....Hope you got me...........Thanks in Advance.......Any Solution would be appreciable....

    Regards,

Similar Threads

  1. Replies: 1
    Last Post: 11th August 2011, 14:18
  2. Creating QObjects before QCoreApplication
    By dawwin in forum Qt Programming
    Replies: 2
    Last Post: 13th April 2011, 18:00
  3. Generic XML Serialization of QObjects
    By nickolais in forum Qt Programming
    Replies: 3
    Last Post: 23rd March 2011, 08:47
  4. Find QObjects that insatlled event filter
    By babu198649 in forum Qt Programming
    Replies: 4
    Last Post: 15th December 2010, 11:27
  5. QObjects as data members stored by value
    By Radagast in forum Qt Programming
    Replies: 3
    Last Post: 6th August 2009, 19:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.