0

On google-api-java-client exists an annotation @Key that it's used for parsing nodes on an XML. I received an answer from analytics service that contains several nodes that start with "dxp:property ". I only need the node that has the attribute name="ga:accountName" for getting the value of another attribute on the same node. But, I don't know if it exists an implementation on the library that google provided for parsing attributes, and I can't find any information on the documentation.

Does someone knows something about this?

Thanks!

Joaquín M
  • 1,135
  • 1
  • 10
  • 20

1 Answers1

1

Founded a way to do this! First, make a List of ProfileItems as an attribute of a class such as:

public class Profile {

    @Key("dxp:property")
    public List<ProfileItem> profiles;

}

Where ProfileItem is defined as:

public class ProfileItem {

    @Key("@name")
    public String name;

    @Key("@value")
    public String value;

}

The @ in the String of the Key annotation marks that name and value are attributes at the node dxp:property.

With this, now I can look for the name attribute that I want, that is ga:accountName.

See you!

Joaquín M
  • 1,135
  • 1
  • 10
  • 20
  • I'm trying to do the same thing with the Google Calendar in regard to the "startTime" and "endTime" of a calendars event. Could you take a look at my post http://stackoverflow.com/questions/6298235/get-google-calendar-events-start-and-end-times-with-google-java-api-client-in-and and tell me what I'm doing wrong? – dell116 Jun 09 '11 at 20:05