XMLListModel



  • Hello all ,

    i have following xml :

    @<Journeys>
        <Journey>
            <SequenceNo>0</SequenceNo>
            <DepDateTime>2012-07-08T16:50:00</DepDateTime>
            <ArrDateTime>2012-07-08T17:16:00</ArrDateTime>
            <DepWalkDist>0</DepWalkDist>
            <ArrWalkDist>0</ArrWalkDist>
            <NoOfChanges>1</NoOfChanges>
            <Guaranteed>false</Guaranteed>
            <CO2factor>10</CO2factor>
            <NoOfZones>5</NoOfZones>
            <PriceZoneList>12000240,12000241,12000242,12000243,12000250</PriceZoneList>
            <FareType>Normaltaxa</FareType>
            <Prices>...</Prices>
            <JourneyKey>...</JourneyKey>
            <RouteLinks>
                <RouteLink>...</RouteLink>
                <RouteLink>...</RouteLink>
            </RouteLinks>
            <RouteLinks>
                <RouteLink>...</RouteLink>
                <RouteLink>...</RouteLink>
            </RouteLinks>
            <Distance>19960</Distance>
            <CO2value>0.002259</CO2value>
        </Journey>
        <Journey>...</Journey>
        <Journey>...</Journey>
        <Journey>...</Journey>
        <Journey>...</Journey>
    </Journeys>@
    

    can anybody help me to understand how i can parse RoutLinks using XMLListModel.

    I mean what should be the query and XPath statement, also in my model i need tags of journey like Sequenceno, NoofChanges etc.



  • You can check " XmlListModel Element official documentation":http://qt-project.org/doc/qt-4.8/qml-xmllistmodel.html as well as examples like "this":http://www.developer.nokia.com/Community/Wiki/Filtering_XmlListModel_data.



  • I think will be better to extend QAbstractItemModel and use it as model. In my opinion, JS in QML must do a little and such complex parsing must be performed in C++.



  • Hello All,

    Thanks for the reply. But i have already used XMLListModel at lots of places !! so i know the simplest use of it.

    I am not a XPath Expert, so i want to understand can i get an array of the RouteLinks tag ?? along with other tags in the xml shown.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.