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

Reply
Trusted Contributor
Mitch99
Posts: 102
Registered: ‎05-09-2013
My Device: BB10 Z10
My Carrier: Virgin
Accepted Solution

XML with one member not loading correctly into Data Model

[ Edited ]

I am using XmlDataAccess class to load an XML list into GroupDataModel. Everything works fine if the XML file has more than one member, however, it fails to load if the list has a single member. I'm using the following code to obtain the XML contents:

 

QVariant list = xda.load(home.absoluteFilePath("MembersList.xml"),"/members/member");

 I need to know if the list has only one, or 2+ members, so I can direct the data model to load with appropriate parameters. Can I find out the number of members in the list?

 

This problem is closely related to this issue, where a QML solution is given.

Please use plain text.
BlackBerry Development Advisor
sabdelsayed
Posts: 249
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: XML with one member not loading correctly into Data Model

[ Edited ]

Hi Mitch99, 

 

Please see this forum post for a workaround to this issue. I have tested it and confirm it works like the QML case.

 

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Trusted Contributor
Mitch99
Posts: 102
Registered: ‎05-09-2013
My Device: BB10 Z10
My Carrier: Virgin

Re: XML with one member not loading correctly into Data Model

Thanks Samar, confirmed, this fixed the issue. The supplied link contains the fix, but not in the post that was accepted as solution, but in a post below it (containing "isEmpty()" reference) - perhaps that should be updated to avoid confusion.

Please use plain text.