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.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
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?

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Highlighted
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
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!
-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!