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: 151
Registered: ‎10-30-2010
My Device: Priv
My Carrier: T-Mobile
Accepted Solution

Parsing/Displaying an RSS feed with attribute format

Hello,

 

I'm trying to incorporate an RSS feed on one tab of my app. The issue I have is that it's not a .xml file I am managing myself. It is hosted from an external source and in in the more common format of <title>Example Title</title>. How can I convert it on the fly to <listItem title="Example Title" />(attribute format)? From there I know how to access and list the data into a ListItem.

 

I'm not very experienced with C++ so I'm hoping it's not too advanced. Even some guidance towards the right tutorials would be appreciated.

 

Thanks!

Developer
Posts: 151
Registered: ‎10-30-2010
My Device: Priv
My Carrier: T-Mobile

Re: Parsing/Displaying an RSS feed with attribute format

[ Edited ]

I'm assuming I should use the code at the bottom of this link titled 

Loading data from a remote source

 

https://developer.blackberry.com/cascades/documentation/device_platform/data_access/using_data_sourc...

 

I copy/pasted all of the QML into a news.qml. There were some brackets missing that caused an error, so I fixed them. I'm coming up with a black screen when I run the code from that sample.

 

I understand I'm supposed to copy some of the C++ as well into my main.cpp file.

 

--

 

// In a C++ source file in your app
  
#include <bb/data/DataSource>
  
...
    // Register the DataSource class as a QML type so that it's accessible in QML
    bb::data&colon;: DataSource::registerQmlTypes();
 
--
 
The #include is simple for me to insert, but I can't seem to find where to paste the 
bb::data&colon;: DataSource::registerQmlTypes();
 
without some kind of error. I 'm afraid that is what my issue is. Can anyone help with this? If it works, I will try to substitute the example .xml with my own and manipulate that to work with my app.
Developer
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free

Re: Parsing/Displaying an RSS feed with attribute format

Use QNetworkAccessManager ! 

 

QNetworkRepy * reply = manager->get(QNetworkRequest("http://xxxxx/file");

connect(reply,SIGNAL(finished(),this,SLOT(parse());

 

void Application:Smiley Tonguearse()

{

QNetworkReply * reply = qobject_cast<QNetworkReply*>(sender());

 

QByteArray data = reply.readAll();

 

now, parse data !!

 

 

}

a lover of Qt
Developer
Posts: 151
Registered: ‎10-30-2010
My Device: Priv
My Carrier: T-Mobile

Re: Parsing/Displaying an RSS feed with attribute format

Thanks for the suggestion dridk but I figured out the problem.

 

I was missing the LIBS += -lbbdata in the .pro. It works now. Smiley Happy