On 8/30/06, wanyancan <[EMAIL PROTECTED]> wrote:
>
> When I'm trying use GData(Java client) to parse a RSS file, I got an
> empty feed. How to parse it?
>
> Actually, I'm wondering whether could I declare my own way to parse a
> feed?
> Is 'declareExtensions' declaring the XML file's structures which
> possibly be understood by GoogleService?

The GData Java client library only has code to support parsing Atom
1.0 XML content.  We figured there was already lots of good RSS parser
implementations out there (like Rome), no reason for us to invent yet
another one.

If you want to use the GData client library along with something like
Rome for RSS parsing, take a look at the Service.createXXXRequest()
methods.   These let you execute a GDataRequest and get an
OutputStream to acccess the response data and hand it off to another
content parser.

If you want a working example of this, look at the implementation of
Service.getFeed() in the Java client library.   It uses the
lower-level createFeedRequest() API to obtain the feed, gets its
response stream, and then hands the stream off to a Feed instance (for
parsing as Atom).   If you wanted to consume RSS, you'd just do
something equivalent in your code, but pass the stream to Rome, JDOM,
SAX Parser, or whatever code you'd like to have handle the XML parsing
of the content.

> Would you please tell me what the following is really doing ?(which
> found in http://code.google.com/apis/gdata/client-java.html)
>
> // Mark the feed as an Event feed:
> new EventFeed().declareExtensions(myService.getExtensionProfile());

The ExtensionProfile defines a mapping from XML extension elements
that are expected within the Atom feed to Java object classes that
will be used to represent them.   For example, in the case of a
Calendar event feed, it initializes the profile to say that some
<gd:when> elements might occur within <atom:entry> and When.class
encapsulates the object model, parser, and XML generator for <gd:when>
content.

> Thanks a lot.

You're welcome.  Hope this helps!

-- Kyle

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi
-~----------~----~----~----~------~----~------~--~---

Reply via email to