I’m trying to acquire the <gCal:color value="xxxxxx"> value attribute from the Atom XML response in the google-api-java-client on Android. For some reason it isn’t getting parsed, despite having a @Key defined for it. I can see it appearing in the actual XML response, but it’s not parsed into the pojo properly.
Consider these pieces of code I’ve altered…
I added the gCal namespace:
AtomParser parser = new AtomParser();
parser.namespaceDictionary = Util.DICTIONARY;
parser.namespaceDictionary.set("gCal", "http://schemas.google.com/gCal/2005"); // I added this.
I added the gCal:color key to the CalendarEntry class:
@Key("gCal:color/@value")
public String color;
When I read the resulting CalendarEntry, the “color” String is still null.
No run-time errors occurring. A slight alteration, like “gCal:colors”, would cause a HTTP 400 Bad Request. I was able to add @Key(“id”), which works great, but none of the gCal stuff is coming back.
Thoughts?
Solved…
I had to pull
gCal:colorand@valueseparately, rather than in one fell swoop with XPath.. ugh! time wasted on stupid shit, but that’s ok..So I created a class called ColorNode with a single key:
And the CalendarEntry class then has a Key for the ColorNode: