Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. XSD: XML Data Binding for Qt
QtWS25 Last Chance

XSD: XML Data Binding for Qt

Scheduled Pinned Locked Moved General and Desktop
17 Posts 8 Posters 19.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andreas
    wrote on 7 Dec 2010, 12:09 last edited by
    #6

    After an extensive web search I expected already that there is no such xml data binding using Qt Xml out there. Thanks.

    --
    Andreas

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dguimard
      wrote on 3 Jan 2011, 21:09 last edited by
      #7

      Hello , what do you mean by XML Schema (XSD) to C++ data binding compiler for Qt ?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Panke
        wrote on 5 Jan 2011, 11:33 last edited by
        #8

        "An Explanation":http://www.artima.com/cppsource/xml_data_binding.html

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on 5 Jan 2011, 12:40 last edited by
          #9

          I find this a very interesting topic. I have been thinking about the possibilities for such a thing for Qt as well for a while now. In my opinion, a real solution would have to be much broader than just XML. It would have to be a data framework for strongly typed data that can work with basically data backends: xml files, (sql) databases, webservices, and even custom file formats. There are partial solutions available, but nothing that unifies them or works in a flexible and sane way.

          Anyway, such a thing is more of a topic for the brainstorming forum, I guess...

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dguimard
            wrote on 5 Jan 2011, 12:57 last edited by
            #10

            Does that bring us to domain specific language since XML is a DSL for instance.

            The DSL could solve any aspect as far that we provide the language description,XTEXT does that very well.

            example :

            @datatype String
            datatype Bool

            entity Session {
            title: String
            isTutorial : Bool
            }

            entity Conference {
            name : String
            attendees : Person*
            speakers : Speaker*
            }

            entity Person {
            name : String
            }

            entity Speaker extends Person {
            sessions : Session*
            }
            @

            the transformation then could produce the code that you need since we control and define what an entity mean, Xtext take care to produce the grammar for you.

            "XTEXT DOC":http://www.eclipse.org/Xtext/documentation/1_0_1/xtext.html#HowDoesItWork

            Sure they are many DSL engine out there.
            I hope it's not out of scope , xml bindind question where related to DSL to be generic enough and able to express differents concerns...
            what do you think ?

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fcrochik
              wrote on 5 Jan 2011, 13:57 last edited by
              #11

              [quote author="Andre" date="1294231224"]I find this a very interesting topic. I have been thinking about the possibilities for such a thing for Qt as well for a while now. In my opinion, a real solution would have to be much broader than just XML. It would have to be a data framework for strongly typed data that can work with basically data backends: xml files, (sql) databases, webservices, and even custom file formats. There are partial solutions available, but nothing that unifies them or works in a flexible and sane way.

              Anyway, such a thing is more of a topic for the brainstorming forum, I guess...[/quote]

              Andre: This sounds a lot like the .Net DataSet. I think some solution like this would be great and I have thought about starting one but haven't found the time. I am working on a project that can consume "the same" data from Sql database, web service and/or xml file but it is not Qt.

              I like the approach of a tool that can generate (and regenerate) source code based on xsd file and/or sql database structure.

              Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dguimard
                wrote on 5 Jan 2011, 14:20 last edited by
                #12

                Hi ,

                i did a tools that generate database layer coming from domain objects definition or webservice ( rest base on json only for now ).
                i will share it shortly as it need a more descent packaging.
                It enable CRUD generation of course but also custom query with parameters .All the method are expose in a databaseManager classes.I started by an xsd like blend 4 does but in the end i replace it by a domain definition witch allow me to define the business service layer more easily.I will do as fast as i could maybe it will interest you as it save to me a looooooooooooot of time.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on 5 Jan 2011, 14:28 last edited by
                  #13

                  [quote author="fcrochik" date="1294235871"]Andre: This sounds a lot like the .Net DataSet.[/quote]
                  No, I see more in a code-generating solution. I think such an approach would result in much better and easier to read and maintain code, as you end up with specialized classes with appropriate methods for reading and writing data. I think something like

                  @
                  Person p = datasource.createPerson();
                  p.setName("Andre");
                  p.setAge(35);
                  p.store();
                  @

                  is more readable than something like:

                  @
                  Table persons = datasource.tables("persons");
                  persons.addRow();
                  persons.setField("name", "Andre");
                  persons.setField("age", 35);
                  persons.commit();
                  @

                  or something along those lines...

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    fcrochik
                    wrote on 5 Jan 2011, 14:46 last edited by
                    #14

                    [quote author="Andre" date="1294237714"]
                    @
                    Person p = datasource.createPerson();
                    p.setName("Andre");
                    p.setAge(35);
                    p.store();
                    @
                    [/quote]

                    That is exactly how the "strong type"/dataset works on .net. The main difference is that you use "adapters" to store/read the data so you separate the data classes from how you store the data and can use the same "data" classes with different "storage". In fact, because of the .net properties it would be more like:

                    @
                    Person p = datasource.Person.New();
                    // in qt/c++ we would need to use p.setName(...) so we could validate
                    // the new value and fire signals if needed
                    p.Name = "Andre";
                    p.Age = 35;
                    datasource.Person.Add(p);

                    PersonDbAdptr adptr;
                    adptr.Update(datasource.Person);
                    @

                    Also, my previous post was not very clear: Visual Studio DOES generate the code and that is one of the things I like about it. Of course, the generated classes inherit the base/common functionality from other classes and do not include every single function needed.

                    Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      fcrochik
                      wrote on 5 Jan 2011, 14:49 last edited by
                      #15

                      [quote author="dguimard" date="1294237203"]Hi ,

                      i did a tools that generate database layer coming from domain objects definition or webservice ( rest base on json only for now ).
                      i will share it shortly as it need a more descent packaging.
                      It enable CRUD generation of course but also custom query with parameters .All the method are expose in a databaseManager classes.I started by an xsd like blend 4 does but in the end i replace it by a domain definition witch allow me to define the business service layer more easily.I will do as fast as i could maybe it will interest you as it save to me a looooooooooooot of time.[/quote]

                      dguimard: Keep us posted. I would like very much to see what you have done.

                      Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        andre
                        wrote on 5 Jan 2011, 15:11 last edited by
                        #16

                        [quote author="fcrochik" date="1294238802"][quote author="Andre" date="1294237714"]
                        @
                        Person p = datasource.createPerson();
                        p.setName("Andre");
                        p.setAge(35);
                        p.store();
                        @
                        [/quote]

                        That is exactly how the "strong type"/dataset works on .net. The main difference is that you use "adapters" to store/read the data so you separate the data classes from how you store the data and can use the same "data" classes with different "storage". In fact, because of the .net properties it would be more like:

                        @
                        Person p = datasource.Person.New();
                        // in qt/c++ we would need to use p.setName(...) so we could validate
                        // the new value and fire signals if needed
                        p.Name = "Andre";
                        p.Age = 35;
                        datasource.Person.Add(p);

                        PersonDbAdptr adptr;
                        adptr.Update(datasource.Person);
                        @

                        Also, my previous post was not very clear: Visual Studio DOES generate the code and that is one of the things I like about it. Of course, the generated classes inherit the base/common functionality from other classes and do not include every single function needed.[/quote]

                        OK, I misunderstood then.
                        I too am very interested to see what dguimard came up with.

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          dguimard
                          wrote on 5 Jan 2011, 15:32 last edited by
                          #17

                          Dear Fellows ,Be sure i will keep you inform.It s eclipse plugin based(Helios) by the way.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved