×

Discussion Board

Results 1 to 5 of 5

Hybrid View

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    30

    Import a .xml to sqlite database and expose it in a ListView

    Hi

    I'm new to Qt and have been reading the tutorials and documentation about Qt, Qt Quick and Qt Quick Components.

    The documentation is very clear and I am ready to translate my UI sketches to code now.

    However, I'm struggling in implementing one key feature of my future application.

    I need :

    1. To read a xml formatted file (I have the .xsd hence I know the structure) to populate a sqlite database

    2. Expose it, probably through QAbstractItemModel, via ListView.

    What is unclear is :
    1. The most elegant way to parse a given file and populate a sqlite database to have it stored on the device (initialisation or update of the database by adding/updating new items to the database)
    2. Once I have a sqlite database set up and filled, how to link it to a QAbstractItemModel class and, ultimately, have it exposed in a ListView

    I have found fragemented pieces of information, but am unable to pur them all together to achieve my goal, which nevertheless sounds quite basic or generic to my ears.

    Could someone help me, for instance by providing a code example, or pointing me some documented projects to show me how to do this?

    I thank you in advance

    Massis

  2. #2
    Nokia Developer Expert
    Join Date
    Sep 2011
    Posts
    382

    Re: Import a .xml to sqlite database and expose it in a ListView

    Please look at this wiki article.

  3. #3
    Registered User
    Join Date
    May 2012
    Posts
    30

    Re: Import a .xml to sqlite database and expose it in a ListView

    Thanks Devnull. I've started to implement my app, step by step. I've just finished writing the filebrowser, and I'm now ready to write the xmlparser/sql part. After having digested the pages you've indicated

  4. #4
    Registered User
    Join Date
    May 2012
    Posts
    30

    Re: Import a .xml to sqlite database and expose it in a ListView

    Well, it's broadly what I need, but not exactly.

    My need is to :
    1. open a file (xml-formatted) and import its contents to a sqlite db
    2. work on that db (and in fact modify the contents; at this stage the imported file is no longer required)

    I understand how to handle a sqlite db in qml; but how do I parse the XML? Again, my need is not a read-only model to be used in a listview for instance, but to populate/initialise a database.

    From that perspective, I don't see how the XMLListModel can help me?

    thanks

  5. #5
    Nokia Developer Expert
    Join Date
    Sep 2011
    Posts
    382

    Re: Import a .xml to sqlite database and expose it in a ListView

    You are welcome!

    Good to see that your XMLListModel is working now.

    /0

Similar Threads

  1. SQLite database and QML
    By angusr in forum [Archived] Qt Quick
    Replies: 1
    Last Post: 2011-03-29, 16:28
  2. SQLite and or other database.
    By shawty in forum Mobile Java General
    Replies: 6
    Last Post: 2010-03-26, 11:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×