I thought I would post the code to find the length of a
GoogleBaseFeed.  It is based on the utility
public static void dump(BaseFeed feed, OutputStream out) in
sample.util.
This may run out of memory for very large XML documents.

-=beeky

                try {
                        Writer w = new StringWriter() ;
                        XmlWriter xmlW = new XmlWriter(w);
                        feed.generateAtom(xmlW, new ExtensionProfile());
                        w.flush();
                        System.out.println("len=" + w.toString().length())      
;
                        System.out.println(w.toString()) ;
                } catch (Exception e ){
                        e.printStackTrace() ;
                }


On Sep 26, 10:02 am, beeky <[EMAIL PROTECTED]> wrote:
> Celebird,
> What I'm trying to do is call service.batch(url,feed) when my feed is
> one GoogleBaseEntry short of the 1mb limit to minimize the number of
> transactions during my batch insert because I have 15mil records to
> insert.
>
> Your idea is the solution.  I really don't know much about the API yet
> so it did not occur to me to look at the underlying data structures.
> GoogleBaseFeed is also based on the XmlBlob class so I may be able to
> use feed.getXmlBlob.getLength() to find the feed 'size'.  If this does
> not give the size of the contents I'll be able to do it the way you
> suggested, one entry at a time.
>
> Thanks for the tip.
> -=beeky
>
> On Sep 26, 6:41 am, Celebird <[EMAIL PROTECTED]> wrote:
>
> > are you trying to create an xml feed-file or a
> > set of gdata-batch requests -- possibly in a file?
>
> > if they're gdata-batch requests and you don't mind the overhead
> > it might be possible to track GoogleBaseEntry xmlblob lengths
> > for a more accurate size estimate; then send every 8000kb or so.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Base 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-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to