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: 19
Registered: ‎03-06-2014
My Device: blackberry z10 stl100-3
My Carrier: n/a

Extracting QVariantMap data pairs

I have a giant xml file I converted into a QVariantMap:

 

QMap((".root", QVariant(QString, "UpdateApp_Response") )

( "AppCashSign" ,  QVariant(QString, "false") )

( "AppCashTrans" ,  QVariant(QString, "false") )...

 

when I output it to the console it gets cut off before it reaches the good part:

 

<MerchFooter>Thank You For Visiting Us.</MerchFooter>
<AppLanguage>
    <_AppLanguage>
        <LanguageID>1</LanguageID>
        <LanguageValue>Enter Activation Codes</LanguageValue>
    </_AppLanguage>

 

I need to extract the LanguageValue associated with the LanguageID

 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Extracting QVariantMap data pairs

There's limits on what the console prints out for line length and content.

 

Why not just write a quick for loop and check it that way?


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 19
Registered: ‎03-06-2014
My Device: blackberry z10 stl100-3
My Carrier: n/a

Re: Extracting QVariantMap data pairs

good idea, I used this to go through it:

 

for(QVariantMap::const_iterator iter = data.begin(); iter != data.end(); ++iter) {
        qDebug() << iter.key() << iter.value();
}

 

it spat out values like so until it hit the sub Qmap, the place I want the data&colon;

"randomstuff" QVariant(QString, "false")
"morerandomstuff" QVariant(QString, "false")
"morerandomstuff" QVariant(QString, "false")

.....

"MoreStuff" QVariant(QVariantMap, QMap(
("_MoreStuff", QVariant(QVariantList, (QVariant(QVariantMap, QMap(
("stuffID", QVariant(QString, "1") )
( "stuffValue" , QVariant(QString, "I want this value 1") ))) ,
QVariant(QVariantMap, QMap(("stuffID", QVariant(QString, "2") )
( "stuffValue" , QVariant(QString, "I want this value 2") ) ) ) ,
QVariant(QVariantMap, QMap(("stuffID", QVariant(QString, "3") )
( "stuffValue" , QVariant(QString, "I want this value 3...

 

so I basically want to search for stuffID "1" and get the associated stuffValue "I want this value 1"

Developer
Posts: 19
Registered: ‎03-06-2014
My Device: blackberry z10 stl100-3
My Carrier: n/a

Re: Extracting QVariantMap data pairs

[ Edited ]

I simplified the QVariantMap to this:

 

QMap(
	("_MoreStuff", QVariant
		(QVariantList, 
			(QVariant
				(QVariantMap, QMap
					(("stuffID", QVariant(QString, "1") ) 
					( "stuffValue" ,  QVariant(QString, "I want this value 1") ) )
				) ,   
			QVariant
				(QVariantMap, QMap
					(("stuffID", QVariant(QString, "2") ) 
					( "stuffValue" ,  QVariant(QString, "I want this value 2") ) )
				) ,  
			QVariant(
				QVariantMap, QMap
					(("stuffID", QVariant(QString, "3") ) 
					( "stuffValue" ,  QVariant(QString, "I want this value 3") ) )  
				) ...

 I want to search for stuffID of value 2 for instance and get the associated stuffValue of "I want this value 2"

Anyone know how to do this, or point me in the direction of helpful documentation?