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
Developer
Posts: 148
Registered: ‎04-08-2013
My Device: Blackberry 10
My Carrier: Blackberry
Accepted Solution

Which method to use To parse Xml response from CMS

[ Edited ]

Scenerio:

In my app to get the data to be displayed in a listView,I want to sent a request to the CMS ,CMS will respond as XML.Now I should parse this XML and then display them on ListView.

 

Question:

1)Which option should i select to parse the response and show them in list??

    a)XmlDataAccess 

    b)QDomDocument

    c)QXMLStreamParser

    e)QtSoapHttpTransport

 

     

 

   Waiting for ur reply.Plz Help me out

Developer
Posts: 16,984
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Which method to use To parse Xml response from CMS

if you just want to display it a would probably be the easiest solution.

c) was very easy to use, i did not try b) but it would be good if you want to manipulate something beforehand as you download the whole thing.
e) is for SOAP, not plain xml.
----------------------------------------------------------
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
Developer
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10
My Carrier: MTS

Re: Which method to use To parse Xml response from CMS

My vote for b)
-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Developer
Posts: 148
Registered: ‎04-08-2013
My Device: Blackberry 10
My Carrier: Blackberry

Re: Which method to use To parse Xml response from CMS

Thanks for ur reply,

   In my app there is no need to manipulate beforehand.And the protocol used is SOAP.

 

1)As per ur suggestion as my need is to just display the response I should use XMLDataAccess.if so Plz give me some links to some examples which implement on XMLDataAccess I have read the document based on that but failed to implement it

 I have tried this http://opensourcebb.com/osbbx/index.php/tutorials-mobile/23-native-tutorials/cascades-tutorials/38-i...

but here they are using Datasource,Is this the way??

 

2)As the protocol used in app is SOAP where the correct choice is QTSOAP or XMLDataAcess??

 

  Plz help me friend

 

Developer
Posts: 16,984
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Which method to use To parse Xml response from CMS

the tutorial looks good to me.

if you want to call a webservice qtsoap is handy. if you just want to throw you xml at your UI the ListView is the easiest way.
----------------------------------------------------------
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
Developer
Posts: 148
Registered: ‎04-08-2013
My Device: Blackberry 10
My Carrier: Blackberry

Re: Which method to use To parse Xml response from CMS

Thanks for ur reply saprykin,
As far as I know we have to manually name the needed tags and then take the content from them while using QDom right??Is this the common way to parse?Is there any other automatic parser which gives us parsed response as <key,value> pairs.So that we can use the parser as a generic one??
If taking the tag one by one manually is the usual method used then My question is Iam using SOAP protocol in my app Is it Ok if I use QDom.
Plz reply My friend saprykin.
Developer
Posts: 148
Registered: ‎04-08-2013
My Device: Blackberry 10
My Carrier: Blackberry

Re: Which method to use To parse Xml response from CMS

Thanks Simon,
I think u mean XMLDataAccess is the easiest way.right?U didnt specify that in ur reply.

But in that tutorial that u said that it is good there XMLDataAccess is not at all used.Instead they use DataSource.Is that the way.Plz help me
Developer
Posts: 16,984
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Which method to use To parse Xml response from CMS

i have no experience using them, but it looks quite easy in the tutorial.
why don't you try it?

xmldataaccess is Qt, not QML, but it seems to give you the key/value stuff in qvariantmaps. look at the API docs.
----------------------------------------------------------
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
Developer
Posts: 148
Registered: ‎04-08-2013
My Device: Blackberry 10
My Carrier: Blackberry

Re: Which method to use To parse Xml response from CMS

I tried using XMLDataAccess.Actually DataSouce is used for data loading from QML and XmlDataAccess is being used internally by DataSource to perform the XML parsing here.It works fine for data from server as well as local xml file data.