Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Problem while retrieve data from XML
Forum Updated to NodeBB v4.3 + New Features

Problem while retrieve data from XML

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 2.6k Views 1 Watching
  • 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
    assma_ramadan
    wrote on last edited by
    #1

    Currently the XmlListModel is the only element available for reading XML data. This is useful for creating a model from XML data, but does not work well for nested XML list data (since this requires using nested XmlListModels) and also doesn't fit the task if the application only requires some piece of data from the XML, and not a complete model.

    so i have a XML File and i want to view it in sequences when the user click the first sub_category just show the item for the first sub_category not for all etc.... for all sub_category ?

    How to solve this problem using QML ?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      You can create your custom model in C++ (where you will do xml parsing by hand) and provide it to your listview.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mbrasser
        wrote on last edited by
        #3

        Hi,

        You can also use "XMLHttpRequest":http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeglobalobject.html#xmlhttprequest to work with XML data in QML.

        Regards,
        Michael

        1 Reply Last reply
        0
        • A Offline
          A Offline
          assma_ramadan
          wrote on last edited by
          #4

          i need to make it using QML

          what i need exactly is
          when i have a XML file like this :
          @
          <real_estates>

          • <sub_category name="eeeee">
          • <class name="gfgfgf">
          • <purpose name="bgbgbg">
            <area name="ererr" />
            <area name="erere" />
            <area name="werwe" />
            <area name="erfrfd" />
            <area name="vfvf" />
            </purpose>
          • <purpose name="fgfgf">
            <area name="frere" />
            <area name="www" />
            <area name="eewew" />
            <area name="yty" />
            <area name="plpl" />
            <area name="wewe" />
            <area name="lklklk" />
            </purpose>
            <purpose name="wewe">
          • <area name="wewe">
          • <ad>
            <text>ت:5490446-079</text>
            </ad>
          • <ad>
            <text>: 5688989-079</text>
            </ad>
          • <ad>
            <text>: 9649454-079</text>
            </ad>
          • <ad>
            <text>AAAAAAAA</text>
            </ad>
            </area>
            <area name="bbb" />
            <area name="cccc" />
            <area name="hhhh" />
            <area name="lllllll" />
            <area name="yyyy">
            <text>eeeeeee</text>
            </ad>
          • <ad>
            <text>lklkklk</text>
            </ad>
          • <ad>
            <text>8571666-078</text>
            </ad>
            <text> - ت:5922181-079</text>
            </ad>
            </area>
            <area name="lklklk" />
            </purpose>
            <sub_category name="oooooo">
          • <class name="wewe">
          • <purpose name="qwwwe">
            <area name="wwww" />
            <area name="fffff" />
            <area name="mmmmm" />
            </purpose>
            </class>
            </sub_category>
            </real_estates>
            @

          So what i want take just some of it not all of it , when i choose the first cat just see the first not all of data

          [edit: xml highlighted / Denis Kormalev]

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DenisKormalev
            wrote on last edited by
            #5

            Please don't forget to highlight your code blocks with @ tags.
            You can do it with mbrasser's suggestion, but I don't think you should stick to QML. in C++-way it will be much more flexible and with better performance (especially if you will have huge xmls).

            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