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

Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

XML parsing

Hi All,


  I am new to BB10 Development.


I have made connection with my server which is sending data in JSON Format. How to parse it.  Can anyone help me with this.It will be very helpful for me.

Also how to store the parsed data in database or ArrayList. 


Thanks & Regards


Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: XML parsing

check the samples, there is one for JSON afaik.
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 34
Registered: ‎10-28-2012
My Device: Dev Alpha B
My Carrier: Rogers

Re: XML parsing

Not sure if you want XML parsing or JSON parsing, since your title is XML and you're talking about JSON. They are different.


You can parse XML this way:




QDomDocument xmlDoc;
QString parseError;
int errorLine = 0;
int errorCol = 0;
xmlDoc.setContent ( response, &parseError, &errorLine, &errorCol);


if (errorLine == 0 && errorCol == 0){
             QDomNodeList nodes = xmlDoc.elementsByTagName ( "nodeName" );
             if (nodes.length() > 0){

                 QDomNode node = nodes.item(0);
                 QDomElement element = node.toElement();
                 QString stringVal = element.text().trimmed();



Here are example projects for JSON and XML:








*Like or mark as solution!*