언어 설정

Menu
Sites
Language
get data from URL

http://www.biblegateway.com/usage/votd/rss/votd.rdf?$31

Please find the link. please open in IE. In that link the data was

<?xml version="1.0" ?>
- <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
- <channel>
  <title>Bible Gateway's Verse of the Day</title>
  <link>http://www.biblegateway.com</link>
  <description>A daily word of exultation.</description>
  <dc:language>en-us</dc:language>
  <dc:creator>BibleGateway.com</dc:creator>
  <dc:rights>Copyright 2004</dc:rights>
  <dc:date>2013-09-24T12:00:00Z</dc:date>
  <sy:updatePeriod>daily</sy:updatePeriod>
  <sy:updateFrequency>1</sy:updateFrequency>
  <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
- <item>
  <title>Hebrews 10:35-36</title>
  <description>Verse of the day</description>
  <guid isPermaLink="false">http://www.biblegateway.com/passage/?search=Hebrews+10%3A35-36&version=NIV</guid>
- <content:encoded>
<![CDATA[  

&ldquo;So do not throw away your confidence; it will be richly rewarded.   You need to persevere so that when you have done the will of God, you will receive what he has promised.&rdquo;<br/><br/> Brought to you by <a href="http://www.biblegateway.com">BibleGateway.com</a>. Copyright (C) . All Rights Reserved.

  ]]>

  </content:encoded>
  <dc:rights>Powered by BibleGateway.com</dc:rights>
  <dc:date>2013-09-24T12:00:00Z</dc:date>
  </item>
  </channel>
  </rss>

In the above  i have to display the text between

<content:encoded>

</content:encoded>

on a label.

What is the process to get the particular data from that URL. please help me.

 

Thanks

Rajyalakshmi

 

 

 

 

Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

5 댓글
hgw7
Implement Tizen::Ui::ITouchEventListener and in the callback method OnTouchPressed(), you obtain the text using Tizen::Web::Controls::HitElementResult. void WebViewer::OnTouchPressed (const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo) { HitElementResult* pHitElementResult = __pWeb->GetElementByPointN(currentPosition); String str =pHitElementResult->GetContent(); AppLog("str %ls", str.GetPointer()); } Use this string to display in label. pLabel->Construct(Tizen::Graphics::Rectangle(), str);
Alex Dem
Hi, If you do not want open mentioned page in WebView but should reach content of Web page please use IHttpTransactionEventListener. You could create Http session and obtain page content using HTTP GET method like in HttpClient example. You could create Http session with your Host adress "http://www.biblegateway.com"; and perform pHttpRequest->SetUri (L"http://www.biblegateway.com/usage/votd/rss/votd.rdf?$31") result of HTTP GET will comes to OnTransactionReadyToRead() { HttpResponse* pHttpResponse = httpTransaction.GetResponse(); ByteBuffer* pBuffer = pHttpResponse->ReadBodyN(); String htmlContent((char *)(pBuffer->GetPointer())); } htmlContent will contains HyperText Markup of your page. After you could extract data from"content:encoded" tag of htmlContent ( At this moment I did not find comfortable api to parse it). But maybe I dont understand details of your problem from provided description. Alexey.
y Rajyalakshmi
Hi Alexey, Thanks for your great response. It is working fine. But I am getting only content tag - - Bible Gateway's Verse of the Day http://www.biblegateway.com A daily word of exultation. en-us BibleGateway.com Copyright 2004 2013-09-25T12:00:00Z daily 1 2000-01-01(only upto here I got. we have next data also as i send first in my query) The next text i am not getting. what would be the reason. I am using this code result MainForm::RequestHttpGet(void) { result r = E_SUCCESS; HttpTransaction* pHttpTransaction = null; HttpRequest* pHttpRequest = null; if (__pHttpSession == null) { __pHttpSession = new (std::nothrow) HttpSession(); r = __pHttpSession->Construct(NET_HTTP_SESSION_MODE_NORMAL, null, HTTP_CLIENT_HOST_ADDRESS, null); if (IsFailed(r)) { delete __pHttpSession; __pHttpSession = null; AppLogException("Failed to create the HttpSession."); goto CATCH; } r = __pHttpSession->SetAutoRedirectionEnabled(true); TryCatch(r == E_SUCCESS, , "Failed to set the redirection automatically."); } pHttpTransaction = __pHttpSession->OpenTransactionN(); r = GetLastResult(); TryCatch(pHttpTransaction != null, , "Failed to open the HttpTransaction."); r = pHttpTransaction->AddHttpTransactionListener(*this); TryCatch(r == E_SUCCESS, , "Failed to add the HttpTransactionListener."); pHttpRequest = const_cast< HttpRequest* >(pHttpTransaction->GetRequest()); r = pHttpRequest->SetUri(HTTP_CLIENT_REQUEST_URI); TryCatch(r == E_SUCCESS, , "Failed to set the uri."); r = pHttpRequest->SetMethod(NET_HTTP_METHOD_GET); TryCatch(r == E_SUCCESS, , "Failed to set the method."); r = pHttpTransaction->Submit(); TryCatch(r == E_SUCCESS, , "Failed to submit the HttpTransaction."); return r; CATCH: delete pHttpTransaction; pHttpTransaction = null; AppLog("RequestHttpGet() failed. (%s)", GetErrorMessage(r)); return r; } void MainForm::OnTransactionReadyToRead(HttpSession& httpSession, HttpTransaction& httpTransaction, int availableBodyLen) { Utf8Encoding utf8; AppLog("OnTransactionReadyToRead"); HttpResponse* pHttpResponse = httpTransaction.GetResponse(); if (pHttpResponse->GetHttpStatusCode() == HTTP_STATUS_OK) { HttpHeader* pHttpHeader = pHttpResponse->GetHeader(); if (pHttpHeader != null) { String* tempHeaderString = pHttpHeader->GetRawHeaderN(); ByteBuffer* pBuffer = pHttpResponse->ReadBodyN(); /* String decodedStr; utf8.GetString(*pBuffer, decodedStr); AppLog("decoderhtmlContainer %ls",decodedStr.GetPointer());*/ String htmlContent((char *)(pBuffer->GetPointer())); AppLog("htmlContainer %ls",htmlContent.GetPointer()); String text(L"Read Body Length: "); text.Append(availableBodyLen); __pEditArea->SetText(text); Draw(); delete tempHeaderString; delete pBuffer; } } } please let me know what would be the problem. Thanks Rajyalakshmi
Alex Dem
Hi All my changes in HttpClient example are above, and after: String text((char *)(pBuffer->GetPointer())); I have checked received content this way: __pEditArea->SetText(text); I think there are null-symbols (end symbol of char string) hence your text is truncated in AppLog etc. You could hold received content in ByteBuffer and try to find another way to extract needed content. But content should be really in ByteBuffer. Alexey.
y Rajyalakshmi
Hi Thanks for the response. Is it ok if i follow this way... write buffer into Xml file and parsing xml, is ok to continue..? or any other problem will arise Rajyalakshmi