I’m using Restkit to consume a web service that sends back XML. Some of the elements are the datetime type. It looks like Restkit wants to treat these as NSDictionary. Is there a simpler way to handle this? Maybe some way to just get the text between the tags?
Here’s an of what I’m talking about. XML like this:
<lastRenewedDate xsi:type="xs:dateTime">2012-09-18T09:53:00-04:00</lastRenewedDate>
Seems to be interpreted by Restkit like this:
lastRenewedDate = {
text = "2012-09-18T09:53:00-04:00";
"xmlns:xs" = "http://www.w3.org/2001/XMLSchema";
"xmlns:xsi" = "http://www.w3.org/2001/XMLSchema-instance";
"xsi:type" = "xs:dateTime";
};
EDIT: To clarify, I’m asking if there’s a way for Restkit to directly map that text between the tags:
2012-09-18T09:53:00-04:00
directly to an NSString rather than mapping it to an NSDictionary and me having to get that text out.
Not sure if this is what you are asking for, BUT to get the time as a NSString-object you can do this
, where dateFormatter is a NSDateFormatter-object
You can look up how to use dateFormats here