-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force XML List? #274
Comments
So your response has an array of rounds and each round can have an array of games. I think your class definition should then look something like this:
if there is only one round, then you will have a round array with only one element. |
Thank you for the reply! I also have another top level object, the Team, which makes it hard to parse the "games" so I should have included this in my original post. My data looks like this: <teams>
<team code="...">
<name>...</name>
... (other fields)
<games>
<round code="1">
<game .../>
<game .../>
<game .../>
</round>
<round code="2">
<game .../>
<game .../>
</round>
</games>
</team>
<team code="... (another team)">
...
</team>
</teams> and there will be multiple teams. I can parse the fields but I fail to parse the games. How should my Team object look like? Currently it looks like this: class Team: EVObject {
var _code: String = ""
var name: String = ""
//other properties
var round: [Round]?
} However, with this "Team" class, i get the |
because your team has multiple properties it expect games as a property. If you games node had other values besides round, then you would have needed an extra object for storing those values. In this case EVReflection assumes that the list could be used. if you would like to have your games property named round, then you could create a propertymapping for that. |
Thank you for this. Now my "Round" object cannot parse the rounds if there is only one round... I get the following warning:
class Round: EVObject {
var _code: String = ""
//... (other string properties)
var game: [Game]?
} If there are two or more rounds, the the object gets parsed sucessfully. |
First of all, thank you for this library, it has made parsing huge feeds a pleasure!
I would like to ask, if it's possible to force a value to be parced as a list. My data is in XML format, and I have a field "games" which contains a list of rounds, which, in turn contains a list of games like the following:
The problem is that if my dataset contains only one round, then EVReflection cannot parse the list as a list. Instead i get the warning
WARNING: The class 'Round' is not key value coding-compliant for the key 'round'
How can I force the mapping of the rounds as a list, even if there is only one round? Thank you very much!
The text was updated successfully, but these errors were encountered: