Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Developer
zezke
Posts: 820
Registered: ‎12-12-2010
My Carrier: Mobile Vikings
Accepted Solution

What's wrong with my XmlDataModel?

Hi, I have the following XML:

 

<Parkings version="1.0" timestamp="1356710328">
<parkings name="P02" description="Reep" address="Seminariestraat 9,<br>9000 Gent" contactInfo="Tel.: 09 266 29 50" openingHours="24/24 open" open="1" totalCapacity="470" availableCapacity="100" latitude="51.052" longitude="3.731" covered="1">
<activeRoute/>
</parkings>
<parkings name="P04" description="Kouterpoort" address="Savaanstraat 13,<br>9000 Gent" contactInfo="Tel.: 09 266 29 40" openingHours="24/24 open" open="1" totalCapacity="570" availableCapacity="570" latitude="51.049" longitude="3.724" covered="1">
<activeRoute/>
</parkings>
<parkings name="P08" description="Ramen" address="Ramen 23,<br>9000 Gent" contactInfo="Tel.: 09 266 29 70" openingHours="24/24 open" open="1" totalCapacity="270" availableCapacity="45" latitude="51.056" longitude="3.716" covered="1">
<activeRoute/>
</parkings>
<parkings name="P07" description="Sint-Michiels" address="Sint-Michielsplein 8,<br>9000 Gent" contactInfo="Tel.: 09 266 29 20" openingHours="24/24 open" open="1" totalCapacity="460" availableCapacity="35" latitude="51.053" longitude="3.719" covered="1">
<activeRoute/>
</parkings>
<parkings name="P01" description="Vrijdagmarkt" address="Vrijdagmarkt 1,<br>9000 Gent" contactInfo="Tel.: 09 266 29 00 <br> (permanentie)<br> Tel.: 09 266 29 01 <br> (tijdens kantooruren)" openingHours="24/24 open" open="1" totalCapacity="629" availableCapacity="95" latitude="51.057" longitude="3.726" covered="1">
<activeRoute/>
</parkings>
<parkings name="P10" description="Sint-Pietersplein" address="Sint-Pietersplein 65,<br>9000 Gent" contactInfo="Tel.: 09 266 29 60" openingHours="24/24 open" open="1" totalCapacity="697" availableCapacity="70" latitude="51.042" longitude="3.726" covered="1">
<activeRoute/>
</parkings>
</Parkings>

It doesn't get displayed properly, although I use code mostly out of a tutorial. This is the code:

 

XmlDataModel *dataModel = new XmlDataModel();
dataModel->setSource(QUrl("file://" + QDir::homePath() + "/parkings.xml"));

So I pretty much download the XML, write it to a file and then open it using the XmlDataModel. However nothing is displayed in the ListView with the following ListItemComponents:

            listItemComponents: [
                ListItemComponent {
                    type: "parkings"
                    StandardListItem {
                        title: ListItemData.name
                    }
                }
            ]

 What am I doing wrong?

-------------------------------------------
Your like is much appreciated!
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
Developer
zezke
Posts: 820
Registered: ‎12-12-2010
My Carrier: Mobile Vikings

Re: What's wrong with my XmlDataModel?

So a few things were wrong. First of all I totally missed that the root tag is mandatory. Secondly I was writing the text incorrectly to the file which somehow caused extra characters to be written to the file. And finally, it had issues with the bit. I hope this helps somebody!
-------------------------------------------
Your like is much appreciated!
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.