Search This Site

Custom Search

Sunday, November 28, 2010

Re: [bloggerDev] Re: java-client library ( attribute and value parsing )

Hi Brett,

i am using this library.

http://code.google.com/p/gdata-java-client/wiki/MigratingToGoogleApiJavaClient

regards,
ravinder chouhan

On Mon, Nov 29, 2010 at 11:21 AM, Ravinder Chouhan
<ravinder.chouhan@gmail.com> wrote:
> Hi Brett,
>
> I am using the standard mechanism to parse, which is internal to the
> java-client-api. I just prepare the classes with proper (Key)
> information.
>
> Like.
>
> ////////////////////////
>
>  static Feed executeGet(HttpTransport transport, BloggerUrl url,
>      Class<? extends Feed> feedClass) throws IOException {
>    url.fields = GData.getFieldsFor(feedClass);
>    HttpRequest request = transport.buildGetRequest();
>    request.url = url;
>    return request.execute().parseAs(feedClass);
>  }
>
> ///////////////////
>
> Above is the sample GET request i make to retrieve all the post.
> Parsing is internal.  I am just not sure how to give it a Content
> class. with proper keys so that is parses both "type" and  actual
> content text for tag <content>.
>
>
>
>
> regards,
> ravinder chouhan
>
>
>
>
>
>
> On Mon, Nov 29, 2010 at 11:00 AM, Brett Morgan <brettmorgan@google.com> wrote:
>> Ravinder,
>> I can see what you are doing, what I am trying to understand is why.
>> Our gdata-java-client has APIs for getting the posts and comments without
>> having to worry about the underlying atom feed, as demonstrated in the
>> example BloggerClient sample application.
>> http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/blogger/BloggerClient.java
>> Can you please explain why you need to parse the XML directly?
>> brett
>>
>> On Mon, Nov 29, 2010 at 3:43 PM, Ravinder Chouhan
>> <ravinder.chouhan@gmail.com> wrote:
>>>
>>> Hi Brett,
>>>
>>> i dont think the problem is specific to android. I would like to
>>> illustrate in detail.
>>>
>>> Say My <Entry> atom feed looks like the following.
>>>
>>> //////////////////////////
>>>
>>> <entry>
>>>
>>>  <id>tag:blogger.com,1999:blog-3814729847066959676.post-1760873893709316893
>>>                </id>
>>>                <published>2010-11-23T22:17:06.607-08:00</published>
>>>                <updated>2010-11-23T22:17:06.607-08:00</updated>
>>>                <title type='text'>this is test comment</title>
>>>                <content type='html'>this is test comment</content>
>>>                <link rel='edit' type='application/atom+xml'
>>>
>>>  href='http://www.blogger.com/feeds/3814729847066959676/3796980236739359453/comments/default/1760873893709316893'
>>> />
>>>                <link rel='self' type='application/atom+xml'
>>>
>>>  href='http://www.blogger.com/feeds/3814729847066959676/3796980236739359453/comments/default/1760873893709316893'
>>> />
>>>                <link rel='alternate' type='text/html'
>>>
>>>  href='http://testblogsforandroid.blogspot.com/2010/11/test-with-image.html?showComment=1290579426607#c1760873893709316893'
>>>                        title='' />
>>>                <author>
>>>                        <name>ravinder</name>
>>>
>>>  <uri>http://www.blogger.com/profile/13923851672985758751</uri>
>>>                        <email>noreply@blogger.com</email>
>>>                        <gd:extendedProperty
>>> xmlns:gd='http://schemas.google.com/g/2005'
>>>                                name='OpenSocialUserId'
>>> value='13656165085543261495' />
>>>                </author>
>>>                <thr:in-reply-to
>>> xmlns:thr='http://purl.org/syndication/thread/1.0'
>>>
>>>  href='http://testblogsforandroid.blogspot.com/2010/11/test-with-image.html'
>>>
>>>  ref='tag:blogger.com,1999:blog-3814729847066959676.post-3796980236739359453'
>>>
>>>  source='http://www.blogger.com/feeds/3814729847066959676/posts/default/3796980236739359453'
>>>                        type='text/html' />
>>> </entry>
>>>
>>>
>>> ////////////////////
>>>
>>> here as you can see the <content> tag has a type attribute with value
>>> "html"  and "this is test comment"  as the value of the content within
>>> the entry tag.
>>>
>>> I just want to be able to parse the "type" attribute and "this is test
>>> comment"  as value. I am parsing the type in a String with Key
>>> ("@type").
>>>
>>> There are privacy issues with posting the source code ,as i need
>>> permission from the company which could take some time.
>>>
>>>
>>> regards,
>>> ravinder chouhan
>>>
>>> On Mon, Nov 29, 2010 at 8:55 AM, Brett Morgan <brettmorgan@google.com>
>>> wrote:
>>> > hey ravinder,
>>> > I haven't spent any time on android yet, so can you help me out by
>>> > supplying
>>> > a complete project that I can bootstrap from?
>>> > brett
>>> >
>>> > On Mon, Nov 29, 2010 at 2:15 PM, Ravinder <ravinder.chouhan@gmail.com>
>>> > wrote:
>>> >>
>>> >> Brett,
>>> >>
>>> >> i am using this library.
>>> >>
>>> >> http://code.google.com/p/gdata-java-client/downloads/list
>>> >>
>>> >> on android.
>>> >>
>>> >> regards,
>>> >> ravinder chouhan
>>> >>
>>> >>
>>> >> On Nov 29, 12:51 am, Brett Morgan <brettmor...@google.com> wrote:
>>> >> > Ravinder,
>>> >> >
>>> >> > Which client library are you using, if any?
>>> >> >
>>> >> > On Sun, Nov 28, 2010 at 10:45 PM, Ravinder
>>> >> > <ravinder.chou...@gmail.com>wrote:
>>> >> >
>>> >> >
>>> >> >
>>> >> > > My content class looks like this.
>>> >> >
>>> >> > > public class Content {
>>> >> > > @Key("@type")
>>> >> > > public String type;
>>> >> > > // get the src value here.
>>> >> > > @Key("@src")
>>> >> > > public String src;
>>> >> > > // I WANT THE CONTENT VALUE HERE NOT SURE HOW TO GET IT ?
>>> >> > > public String contentvalue;
>>> >> > > }
>>> >> >
>>> >> > > After making a GET request i would like to parse it like.
>>> >> >
>>> >> > > // works.
>>> >> > > String lBlogId = EntryValues.id;
>>> >> >
>>> >> > > // works
>>> >> > > String ltitleString =EntryValues.title;
>>> >> >
>>> >> > > // @todo THIS IS NOT CLEAR.
>>> >> > > String content = EntryValues.content.contentvalue;
>>> >> >
>>> >> > > // works
>>> >> > > String lAuthorName = EntryValues.author.name;
>>> >> >
>>> >> > > //works.
>>> >> > > String type=EntryValues.content.type;
>>> >> >
>>> >> > > Entry class looks like this.
>>> >> >
>>> >> > > public class BloggerEntry extends Entry {
>>> >> >
>>> >> > >          @Key("published")
>>> >> > >          public String published;
>>> >> >
>>> >> > >          @Key("summary")
>>> >> > >          public String summary;
>>> >> >
>>> >> > >          @Key("id")
>>> >> > >          public String id;
>>> >> >
>>> >> > >          // this will store the content description here.
>>> >> > >          // this needs to be checked out. using it as only strings
>>> >> > > works.
>>> >> > >          @Key("content")
>>> >> > >          public Content content;
>>> >> >
>>> >> > >          @Key("updated")
>>> >> > >          public String updated;
>>> >> > > }
>>> >> >
>>> >> > > public class Entry implements Cloneable {
>>> >> >
>>> >> > >  @Key("@gd:etag")
>>> >> > >  public String etag;
>>> >> >
>>> >> > >  @Key("link")
>>> >> > >  public List<Link> links;
>>> >> >
>>> >> > >  @Key("title")
>>> >> > >  public String title;
>>> >> >
>>> >> > >  @Key("author")
>>> >> > >  public Author author;
>>> >> > > }
>>> >> >
>>> >> > > regards,
>>> >> > > ravinder chouhan
>>> >> >
>>> >> > > On Nov 28, 1:56 am, Brett Morgan <brettmor...@google.com> wrote:
>>> >> > > > Hi Ravinder,
>>> >> >
>>> >> > > > Can you supply a cut down version of your code so I can better
>>> >> > > > understand
>>> >> > > > what you are asking?
>>> >> >
>>> >> > > > brett
>>> >> >
>>> >> > > > On Sun, Nov 28, 2010 at 2:44 AM, Ravinder
>>> >> > > > <ravinder.chou...@gmail.com
>>> >> > > >wrote:
>>> >> >
>>> >> > > > > Hi,
>>> >> >
>>> >> > > > > I am using "data-java-client" to work with blogger feeds.  I
>>> >> > > > > would
>>> >> > > > > like to parse the <content> tag, both the attibute "type",
>>> >> > > > > "src"
>>> >> > > > > and
>>> >> > > > > value.
>>> >> >
>>> >> > > > > I have made a new class to work with feeds. I can retrieve the
>>> >> > > > > "type"
>>> >> > > > > by making a String variable key to ("@type"), but i am not sure
>>> >> > > > > how to
>>> >> > > > > get the content value ?
>>> >> >
>>> >> > > > > Any pointers would be of great help in this regard.
>>> >> >
>>> >> > > > > thanks.
>>> >> > > > > ravinder chouhan
>>> >> >
>>> >> > > > > --
>>> >> > > > > You received this message because you are subscribed to the
>>> >> > > > > Google
>>> >> > > Groups
>>> >> > > > > "Blogger Developer Group" group.
>>> >> > > > > To post to this group, send email to
>>> >> > > > > bloggerdev@googlegroups.com.
>>> >> > > > > To unsubscribe from this group, send email to
>>> >> > > > >
>>> >> > > > >
>>> >> > > > > bloggerdev+unsubscribe@googlegroups.com<bloggerdev%2Bunsubscribe@googlegroups.com>
>>> >> > >
>>> >> > >
>>> >> > > <bloggerdev%2Bunsubscribe@googlegroups.com<bloggerdev%252Bunsubscribe@googlegroups.com>
>>> >> >
>>> >> > > > > .
>>> >> > > > > For more options, visit this group at
>>> >> > > > >http://groups.google.com/group/bloggerdev?hl=en.
>>> >> >
>>> >> > > > --
>>> >> > > > Brett Morgan
>>> >> >
>>> >> > > > *Developer Programs Engineer, Blogger*
>>> >> >
>>> >> > > --
>>> >> > > You received this message because you are subscribed to the Google
>>> >> > > Groups
>>> >> > > "Blogger Developer Group" group.
>>> >> > > To post to this group, send email to bloggerdev@googlegroups.com.
>>> >> > > To unsubscribe from this group, send email to
>>> >> > >
>>> >> > >
>>> >> > > bloggerdev+unsubscribe@googlegroups.com<bloggerdev%2Bunsubscribe@googlegroups.com>
>>> >> > > .
>>> >> > > For more options, visit this group at
>>> >> > >http://groups.google.com/group/bloggerdev?hl=en.
>>> >> >
>>> >> > --
>>> >> > Brett Morgan
>>> >> >
>>> >> > *Developer Programs Engineer, Blogger*
>>> >>
>>> >> --
>>> >> You received this message because you are subscribed to the Google
>>> >> Groups
>>> >> "Blogger Developer Group" group.
>>> >> To post to this group, send email to bloggerdev@googlegroups.com.
>>> >> To unsubscribe from this group, send email to
>>> >> bloggerdev+unsubscribe@googlegroups.com.
>>> >> For more options, visit this group at
>>> >> http://groups.google.com/group/bloggerdev?hl=en.
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Brett Morgan
>>> > Developer Programs Engineer, Blogger
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "Blogger Developer Group" group.
>>> > To post to this group, send email to bloggerdev@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> > bloggerdev+unsubscribe@googlegroups.com.
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/bloggerdev?hl=en.
>>> >
>>>
>>>
>>>
>>> --
>>> cheers
>>> Ravinder Chouhan
>>>
>>> Things that are impossible just take longer
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Blogger Developer Group" group.
>>> To post to this group, send email to bloggerdev@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> bloggerdev+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/bloggerdev?hl=en.
>>>
>>
>>
>>
>> --
>> Brett Morgan
>> Developer Programs Engineer, Blogger
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Blogger Developer Group" group.
>> To post to this group, send email to bloggerdev@googlegroups.com.
>> To unsubscribe from this group, send email to
>> bloggerdev+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/bloggerdev?hl=en.
>>
>
>
>
> --
> cheers
> Ravinder Chouhan
>
> Things that are impossible just take longer
>

--
cheers
Ravinder Chouhan

Things that are impossible just take longer

--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To post to this group, send email to bloggerdev@googlegroups.com.
To unsubscribe from this group, send email to bloggerdev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bloggerdev?hl=en.

No comments:

Post a Comment