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
Contributor
lvandyk
Posts: 19
Registered: ‎07-17-2012
My Device: BB 10 Alpha Device
My Carrier: Vodacom

XML and ListView

I have the following XML retrieved from twitter:

 

<statuses type="array">
  <status>
    <created_at>Fri Jan 25 15:47:45 +0000 2013</created_at>
    <id>294833948821954560</id>
    <text>Looking for a replacement for v1's friendships/no_retweet_ids? v1.1 now has an equivalent: https://t.co/gILO7b0U ^TS</text>
    <source>web</source>
    <truncated>false</truncated>
    <in_reply_to_status_id></in_reply_to_status_id>
    <in_reply_to_user_id></in_reply_to_user_id>
    <in_reply_to_screen_name></in_reply_to_screen_name>
    <possibly_sensitive>false</possibly_sensitive>
    <user>
      <id>6253282</id>
      <name>Twitter API</name>
      <screen_name>twitterapi</screen_name>
      <location>San Francisco, CA</location>
      <profile_image_url>http://a0.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png</profile_image_url>
      <profile_image_url_https>https://si0.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png</profile_image_url_https>
      <url>http://dev.twitter.com</url>
      <description>The Real Twitter API. I tweet about API changes, service issues and happily answer questions about Twitter and our API. Don't get an answer? It's on my website.</description>
      <protected>false</protected>
      <followers_count>1453582</followers_count>
      <profile_background_color>C0DEED</profile_background_color>
      <profile_text_color>333333</profile_text_color>
      <profile_link_color>0084B4</profile_link_color>
      <profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
      <profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
      <friends_count>33</friends_count>
      <created_at>Wed May 23 06:01:13 +0000 2007</created_at>
      <favourites_count>25</favourites_count>
      <utc_offset>-28800</utc_offset>
      <time_zone>Pacific Time (US &amp; Canada)</time_zone>
      <profile_background_image_url>http://a0.twimg.com/profile_background_images/656927849/miyt9dpjz77sc0w3d4vj.png</profile_background_image_url>
      <profile_background_image_url_https>https://si0.twimg.com/profile_background_images/656927849/miyt9dpjz77sc0w3d4vj.png</profile_background_image_url_https>
      <profile_background_tile>true</profile_background_tile>
      <profile_use_background_image>true</profile_use_background_image>
      <geo_enabled>true</geo_enabled>
      <verified>true</verified>
      <statuses_count>3370</statuses_count>
      <lang>en</lang>
      <contributors_enabled>true</contributors_enabled>
      <is_translator>false</is_translator>
      <listed_count>11219</listed_count>
      <default_profile>false</default_profile>
      <default_profile_image>false</default_profile_image>
      <following></following>
      <follow_request_sent></follow_request_sent>
      <notifications></notifications>
    </user>
    <geo/>
    <coordinates/>
    <place/>
    <contributors>
      <user_id>819797</user_id>
    </contributors>
    <retweet_count>33</retweet_count>
    <favorited>false</favorited>
    <retweeted>false</retweeted>
  </status>
  <status>
    <created_at>Tue Jan 22 23:03:46 +0000 2013</created_at>
    <id>293856509547388929</id>
    <text>We expect our user IDs to exceed the signed 32-bit boundary sometime this year.  Time to move to 64-bit: https://t.co/U3zYCnOR ^ARK</text>
    <source>web</source>
    <truncated>false</truncated>
    <in_reply_to_status_id></in_reply_to_status_id>
    <in_reply_to_user_id></in_reply_to_user_id>
    <in_reply_to_screen_name></in_reply_to_screen_name>
    <possibly_sensitive>false</possibly_sensitive>
    <user>
      <id>6253282</id>
      <name>Twitter API</name>
      <screen_name>twitterapi</screen_name>
      <location>San Francisco, CA</location>
      <profile_image_url>http://a0.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png</profile_image_url>
      <profile_image_url_https>https://si0.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png</profile_image_url_https>
      <url>http://dev.twitter.com</url>
      <description>The Real Twitter API. I tweet about API changes, service issues and happily answer questions about Twitter and our API. Don't get an answer? It's on my website.</description>
      <protected>false</protected>
      <followers_count>1453582</followers_count>
      <profile_background_color>C0DEED</profile_background_color>
      <profile_text_color>333333</profile_text_color>
      <profile_link_color>0084B4</profile_link_color>
      <profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
      <profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
      <friends_count>33</friends_count>
      <created_at>Wed May 23 06:01:13 +0000 2007</created_at>
      <favourites_count>25</favourites_count>
      <utc_offset>-28800</utc_offset>
      <time_zone>Pacific Time (US &amp; Canada)</time_zone>
      <profile_background_image_url>http://a0.twimg.com/profile_background_images/656927849/miyt9dpjz77sc0w3d4vj.png</profile_background_image_url>
      <profile_background_image_url_https>https://si0.twimg.com/profile_background_images/656927849/miyt9dpjz77sc0w3d4vj.png</profile_background_image_url_https>
      <profile_background_tile>true</profile_background_tile>
      <profile_use_background_image>true</profile_use_background_image>
      <geo_enabled>true</geo_enabled>
      <verified>true</verified>
      <statuses_count>3370</statuses_count>
      <lang>en</lang>
      <contributors_enabled>true</contributors_enabled>
      <is_translator>false</is_translator>
      <listed_count>11219</listed_count>
      <default_profile>false</default_profile>
      <default_profile_image>false</default_profile_image>
      <following></following>
      <follow_request_sent></follow_request_sent>
      <notifications></notifications>
    </user>
    <geo/>
    <coordinates/>
    <place/>
    <contributors>
      <user_id>7588892</user_id>
    </contributors>
    <retweet_count>253</retweet_count>
    <favorited>false</favorited>
    <retweeted>false</retweeted>
  </status>
</statuses>

 

I have tried using ListItemComponents to display the tweet text to no avail:

 

ListView 
{
    objectName: "twitterLSTVW"
    verticalAlignment: VerticalAlignment.Center
    horizontalAlignment: HorizontalAlignment.Center

    layout: FlowListLayout {}
    dataModel: XmlDataModel {source: "model.xml"}
            	    
    listItemComponents: [
			 ListItemComponent
                         {
			     type: "status"
					 
			     Container
                             {
			       id: item 
			       Label { text: ListItem.text.data }
			     }
                         }
		         ]
                 
 }

 

I have tried looking for examples but all of them include models that just use attributes and are not really nested.

 

If someone could please provide me with the right code to the listItemComponents.

 

Thanks!

 

Please use plain text.
Developer
javayoung
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: XML and ListView

[ Edited ]

Maybe it can only support for the tag with attributes. Like this one:

<root>    
    <item title="BlackBerry Dev" 	feedlink="http://feeds.feedburner.com/blackberry/CAxx?format=xml"/>
    <item title="Open BB News" 		feedlink="http://openbbnews.wordpress.com/feed/"/>
 </root>

 Your provided XML format is different. You can have a try with a customized datasource to read XML.

See the sample codes : rssnews and tldr

 

The official document for DataSource is located at

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




p(^_^)q
Good good study, day day up
Please use plain text.
Contributor
sneha_J
Posts: 21
Registered: ‎02-10-2012
My Device: 8520, 9790
My Carrier: Airtel

Re: XML and ListView

Hello,

 

How you get the xml from twitter feeds..

 

can you please give me the link of .jar which you have used to get that xml ..

 

please help ..

Please use plain text.