0

I'm making an iphone app in xcode that has to be able to read xml retrieved from the web. It works with every xml ive tried except this one. What's wrong with it?

<appMetrics versionName="1.1.0" startDate="2013-04-16" metric="ActiveUsersByDay" groupBy="dayOfYear" endDate="2013-04-18" country="US" version="1.0" generatedDate="4/19/13 10:10 AM">
<day value="6" date="2013-04-16"/>
<day value="4" date="2013-04-17"/>
<day value="2" date="2013-04-18"/>
</appMetrics>
  • Are you using NSXMLParser or libxml2? Are you getting partial parsing? What error message are you getting? – Brian Nickel Apr 19 '13 at 17:52
  • I'm not getting any error, it's just not successfully reading any elements. Im using NSXMLParser – user1858163 Apr 19 '13 at 17:57
  • Although when you enter the link in a browser it says: This XML file does not appear to have any style information associated with it. The document tree is shown below. – user1858163 Apr 19 '13 at 18:03
  • That's a normal browser action. Have you validated that the data is getting to the XML parser correctly? Full data, no errors? Nothing looks wrong with the XML so there's not much to say without your actual code. – Brian Nickel Apr 19 '13 at 18:11
  • Is it possible that you have whitespace at the start of the HTTP response body? That can trip most XML parsers up. – mflaming Apr 19 '13 at 20:39

1 Answers1

0

The problem was that when I entered the URL in a browser, it would give me a XML, but when in xcode it would give me a JSON. I just had to request it in XML format.