views:

15

answers:

1

I have an application that currently uses Apache Abdera to parse Atom Pub documents (Workspace, Collection, Feed, Entry) - and want to switch the the GData Libraries, mainly to get rid of a lot of dependencies and I have found the GData calls to be consistently faster. Anyway, I cannot figure out how to generate some of these document types through GData.

Example:

Workspace w = new Workspace(new PlainTextConstruct("My Workspace"));
System.out.println(w); // prints a memory location
System.out.println(w.getXmlBlob()); // prints memory location or null

In Abdera this would have worked. I am guessing I am missing the use of some parsing class, but the documentation is not very forward on this topic.

I am expecting a document like this (not exactly):

<workspace><atom:title>My Workspace</atom:title></workspace>
A: 

Well I managed to find the answer myself, still trying to figure out how to assign a default namespace so it doesn't append "atom" to every xml tag.

Workspace workspace = new Workspace(new PlainTextConstruct("My Workspace"));
CharArrayWriter charWr = new CharArrayWriter();
workspace.generate(new XmlWriter(charWr), new ExntensionProfile());
System.out.println(charWr.toString());
Gandalf