You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@abdera.apache.org by Tyrell Perera <ty...@wso2.com> on 2007/08/08 01:08:43 UTC
Sample code for an Atom Feed reader
Hi,
I am in the process of implementing an Atom feed reader. The requirement
is to read a published, online feed fully and persist it locally for
offline manipulation.
I found some useful tutorials at developerworks, which helped in my APP
stuff tremendously. But I'm a bit stuck with this seemingly simple part :)
I would appreciate if you can provide some pointers, where I can get
more information and/or a tutorial.
thanks,
Tyrell
Re: Sample code for an Atom Feed reader
Posted by Tyrell Perera <ty...@wso2.com>.
Figured out the issue. The Atom feed I used for testing wasn't well formed.
Tyrell
Tyrell Perera wrote:
> I think I wasn't very clear earlier :)
>
> The thing is I already have a working APP implementation capable of
> authentication and post/put/delete entries from a given collection.
>
> I want to implement a 'get' for a Feed. The method will accept an atom
> feed url and generate a Feed model locally.
>
> My code looks somewhat like the following. I tested with an online feed
> as well as a locally stored feed xml. I keep gettin a
> org.apache.abdera.parser.stax.FOMExtensibleElement exception.
>
> <code>
>
> org.apache.abdera.parser.Parser parser = hostObject.abdera.getParser();
> URL url = new URL((String) arguments[0]);
> Feed feed = null;
> try {
> feed = (Feed) parser.parse(url.openStream()).getRoot();
> } catch (IRISyntaxException e) {
> e.printStackTrace();
> }
>
> </code>
>
> Am I doing something wrong here ?
>
> thanks,
>
> Tyrell
>
> Yogesh Mujumdar wrote:
>> You say that you are able to manipulate the feeds, but not able to
>> build a
>> feed from a published source over the internet. Do you mean you are
>> not able
>> to retrieve the feed from the internet? In which case, you gotta check
>> the
>> code which does it.
>>
>> On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>>> Thanks for the quick reply. I already have a working APP implementation
>>> where authentication and get/post/delete entry are working.
>>>
>>> I just want to do a basic retrieval of an online feed. Just a simple get
>>> and build a Feed model from it. This is failing for some reason. Maybe
>>> I'm doing something wrong?
>>>
>>> Tyrell
>>>
>>> Yogesh Mujumdar wrote:
>>>> AFAIK, Abdera has an example showing how to retrieve and manipulate a
>>>> feed/entries and post it back. You can take a look at it and make a
>>> start
>>>> from there.
>>>>
>>>> You can as well take any open source feed reader ( RSSowl ) and get
>>>> some
>>>> features as well as implementation ideas.
>>>>
>>>> Good luck to you!
>>>>
>>>> On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>>>>> Hi,
>>>>>
>>>>> I am in the process of implementing an Atom feed reader. The
>>> requirement
>>>>> is to read a published, online feed fully and persist it locally for
>>>>> offline manipulation.
>>>>>
>>>>> I found some useful tutorials at developerworks, which helped in my
>>>>> APP
>>>>> stuff tremendously. But I'm a bit stuck with this seemingly simple
>>>>> part
>>> :)
>>>>> I would appreciate if you can provide some pointers, where I can get
>>>>> more information and/or a tutorial.
>>>>>
>>>>> thanks,
>>>>>
>>>>> Tyrell
>>>>>
>>>>
>>>>
>>> --
>>> Tyrell Perera
>>> Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
>>> email: tyrell@wso2.com; cell: +94 77 302 2505
>>>
>>> "Oxygenating the Web Service Platform."
>>>
>>
>>
>>
>
--
Tyrell Perera
Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
email: tyrell@wso2.com; cell: +94 77 302 2505
"Oxygenating the Web Service Platform."
Re: Sample code for an Atom Feed reader
Posted by James M Snell <ja...@gmail.com>.
Grab the Abdera client module.
Abdera abdera = new Abdera();
AbderaClient client = new AbderaClient(abdera);
ClientResponse resp = client.get("http://example.org/somefeed.xml");
Document<Feed> doc = resp.getDocument();
Feed feed = doc.getRoot();
// when you're done with the feed
resp.release();
- James
Tyrell Perera wrote:
> I think I wasn't very clear earlier :)
>
> The thing is I already have a working APP implementation capable of
> authentication and post/put/delete entries from a given collection.
>
> I want to implement a 'get' for a Feed. The method will accept an atom
> feed url and generate a Feed model locally.
>
> My code looks somewhat like the following. I tested with an online feed
> as well as a locally stored feed xml. I keep gettin a
> org.apache.abdera.parser.stax.FOMExtensibleElement exception.
>
> <code>
>
> org.apache.abdera.parser.Parser parser = hostObject.abdera.getParser();
> URL url = new URL((String) arguments[0]);
> Feed feed = null;
> try {
> feed = (Feed) parser.parse(url.openStream()).getRoot();
> } catch (IRISyntaxException e) {
> e.printStackTrace();
> }
>
> </code>
>
> Am I doing something wrong here ?
>
> thanks,
>
> Tyrell
>
> Yogesh Mujumdar wrote:
>> You say that you are able to manipulate the feeds, but not able to
>> build a
>> feed from a published source over the internet. Do you mean you are
>> not able
>> to retrieve the feed from the internet? In which case, you gotta check
>> the
>> code which does it.
>>
>> On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>>> Thanks for the quick reply. I already have a working APP implementation
>>> where authentication and get/post/delete entry are working.
>>>
>>> I just want to do a basic retrieval of an online feed. Just a simple get
>>> and build a Feed model from it. This is failing for some reason. Maybe
>>> I'm doing something wrong?
>>>
>>> Tyrell
>>>
>>> Yogesh Mujumdar wrote:
>>>> AFAIK, Abdera has an example showing how to retrieve and manipulate a
>>>> feed/entries and post it back. You can take a look at it and make a
>>> start
>>>> from there.
>>>>
>>>> You can as well take any open source feed reader ( RSSowl ) and get
>>>> some
>>>> features as well as implementation ideas.
>>>>
>>>> Good luck to you!
>>>>
>>>> On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>>>>> Hi,
>>>>>
>>>>> I am in the process of implementing an Atom feed reader. The
>>> requirement
>>>>> is to read a published, online feed fully and persist it locally for
>>>>> offline manipulation.
>>>>>
>>>>> I found some useful tutorials at developerworks, which helped in my
>>>>> APP
>>>>> stuff tremendously. But I'm a bit stuck with this seemingly simple
>>>>> part
>>> :)
>>>>> I would appreciate if you can provide some pointers, where I can get
>>>>> more information and/or a tutorial.
>>>>>
>>>>> thanks,
>>>>>
>>>>> Tyrell
>>>>>
>>>>
>>>>
>>> --
>>> Tyrell Perera
>>> Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
>>> email: tyrell@wso2.com; cell: +94 77 302 2505
>>>
>>> "Oxygenating the Web Service Platform."
>>>
>>
>>
>>
>
Re: Sample code for an Atom Feed reader
Posted by Tyrell Perera <ty...@wso2.com>.
I think I wasn't very clear earlier :)
The thing is I already have a working APP implementation capable of
authentication and post/put/delete entries from a given collection.
I want to implement a 'get' for a Feed. The method will accept an atom
feed url and generate a Feed model locally.
My code looks somewhat like the following. I tested with an online feed
as well as a locally stored feed xml. I keep gettin a
org.apache.abdera.parser.stax.FOMExtensibleElement exception.
<code>
org.apache.abdera.parser.Parser parser = hostObject.abdera.getParser();
URL url = new URL((String) arguments[0]);
Feed feed = null;
try {
feed = (Feed) parser.parse(url.openStream()).getRoot();
} catch (IRISyntaxException e) {
e.printStackTrace();
}
</code>
Am I doing something wrong here ?
thanks,
Tyrell
Yogesh Mujumdar wrote:
> You say that you are able to manipulate the feeds, but not able to build a
> feed from a published source over the internet. Do you mean you are not able
> to retrieve the feed from the internet? In which case, you gotta check the
> code which does it.
>
> On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>> Thanks for the quick reply. I already have a working APP implementation
>> where authentication and get/post/delete entry are working.
>>
>> I just want to do a basic retrieval of an online feed. Just a simple get
>> and build a Feed model from it. This is failing for some reason. Maybe
>> I'm doing something wrong?
>>
>> Tyrell
>>
>> Yogesh Mujumdar wrote:
>>> AFAIK, Abdera has an example showing how to retrieve and manipulate a
>>> feed/entries and post it back. You can take a look at it and make a
>> start
>>> from there.
>>>
>>> You can as well take any open source feed reader ( RSSowl ) and get some
>>> features as well as implementation ideas.
>>>
>>> Good luck to you!
>>>
>>> On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>>>> Hi,
>>>>
>>>> I am in the process of implementing an Atom feed reader. The
>> requirement
>>>> is to read a published, online feed fully and persist it locally for
>>>> offline manipulation.
>>>>
>>>> I found some useful tutorials at developerworks, which helped in my APP
>>>> stuff tremendously. But I'm a bit stuck with this seemingly simple part
>> :)
>>>> I would appreciate if you can provide some pointers, where I can get
>>>> more information and/or a tutorial.
>>>>
>>>> thanks,
>>>>
>>>> Tyrell
>>>>
>>>
>>>
>> --
>> Tyrell Perera
>> Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
>> email: tyrell@wso2.com; cell: +94 77 302 2505
>>
>> "Oxygenating the Web Service Platform."
>>
>
>
>
--
Tyrell Perera
Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
email: tyrell@wso2.com; cell: +94 77 302 2505
"Oxygenating the Web Service Platform."
Re: Sample code for an Atom Feed reader
Posted by Yogesh Mujumdar <yo...@gmail.com>.
You say that you are able to manipulate the feeds, but not able to build a
feed from a published source over the internet. Do you mean you are not able
to retrieve the feed from the internet? In which case, you gotta check the
code which does it.
On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>
> Thanks for the quick reply. I already have a working APP implementation
> where authentication and get/post/delete entry are working.
>
> I just want to do a basic retrieval of an online feed. Just a simple get
> and build a Feed model from it. This is failing for some reason. Maybe
> I'm doing something wrong?
>
> Tyrell
>
> Yogesh Mujumdar wrote:
> > AFAIK, Abdera has an example showing how to retrieve and manipulate a
> > feed/entries and post it back. You can take a look at it and make a
> start
> > from there.
> >
> > You can as well take any open source feed reader ( RSSowl ) and get some
> > features as well as implementation ideas.
> >
> > Good luck to you!
> >
> > On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
> >> Hi,
> >>
> >> I am in the process of implementing an Atom feed reader. The
> requirement
> >> is to read a published, online feed fully and persist it locally for
> >> offline manipulation.
> >>
> >> I found some useful tutorials at developerworks, which helped in my APP
> >> stuff tremendously. But I'm a bit stuck with this seemingly simple part
> :)
> >>
> >> I would appreciate if you can provide some pointers, where I can get
> >> more information and/or a tutorial.
> >>
> >> thanks,
> >>
> >> Tyrell
> >>
> >
> >
> >
>
> --
> Tyrell Perera
> Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
> email: tyrell@wso2.com; cell: +94 77 302 2505
>
> "Oxygenating the Web Service Platform."
>
--
Yogesh
Re: Sample code for an Atom Feed reader
Posted by Tyrell Perera <ty...@wso2.com>.
Thanks for the quick reply. I already have a working APP implementation
where authentication and get/post/delete entry are working.
I just want to do a basic retrieval of an online feed. Just a simple get
and build a Feed model from it. This is failing for some reason. Maybe
I'm doing something wrong?
Tyrell
Yogesh Mujumdar wrote:
> AFAIK, Abdera has an example showing how to retrieve and manipulate a
> feed/entries and post it back. You can take a look at it and make a start
> from there.
>
> You can as well take any open source feed reader ( RSSowl ) and get some
> features as well as implementation ideas.
>
> Good luck to you!
>
> On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>> Hi,
>>
>> I am in the process of implementing an Atom feed reader. The requirement
>> is to read a published, online feed fully and persist it locally for
>> offline manipulation.
>>
>> I found some useful tutorials at developerworks, which helped in my APP
>> stuff tremendously. But I'm a bit stuck with this seemingly simple part :)
>>
>> I would appreciate if you can provide some pointers, where I can get
>> more information and/or a tutorial.
>>
>> thanks,
>>
>> Tyrell
>>
>
>
>
--
Tyrell Perera
Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
email: tyrell@wso2.com; cell: +94 77 302 2505
"Oxygenating the Web Service Platform."
Re: Sample code for an Atom Feed reader
Posted by Yogesh Mujumdar <yo...@gmail.com>.
AFAIK, Abdera has an example showing how to retrieve and manipulate a
feed/entries and post it back. You can take a look at it and make a start
from there.
You can as well take any open source feed reader ( RSSowl ) and get some
features as well as implementation ideas.
Good luck to you!
On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>
> Hi,
>
> I am in the process of implementing an Atom feed reader. The requirement
> is to read a published, online feed fully and persist it locally for
> offline manipulation.
>
> I found some useful tutorials at developerworks, which helped in my APP
> stuff tremendously. But I'm a bit stuck with this seemingly simple part :)
>
> I would appreciate if you can provide some pointers, where I can get
> more information and/or a tutorial.
>
> thanks,
>
> Tyrell
>
--
Yogesh