Thursday, 22 August 2013

Parsing XML attributes and text with Google XmlObjectParser

Parsing XML attributes and text with Google XmlObjectParser

I'm using Google's client API's to send queries wrapped in XML to a server
and then parse the XML response into POJO's. The XML is being parsed using
com.google.api.client.xml.XmlObjectParser. I run into a problem with the
following XML fragment ...
<DATE TYPE="START">2011-07-26T05:00</DATE>
If the POJO looks like this ...
public class Date {
@Key("@TYPE")
public String type;
}
The TYPE attribute works fine. The application will read and write it. But
how do I read and write the content (2011-07-26T05:00)?

No comments:

Post a Comment