I have a problem with the class XMLReader ( https://github.com/Insert-Witty-Name/XML-to-NSDictionary ).
When i parse this document, it’s work perfectly
<webservices>
<title>Photos</title>
<item>
<name>test</name>
</item>
<item>
<name>test2</name>
</item>
</webservices>
The programme display :
webservices = {
item = (
{
name= "test1.";
},
{
name= "test2";
}
);
title = Photos;
};
}
But when i have one Item, it’s doesn’t work. I’m not a NSarray of Item but a NSDictionnary with directy the node “name”.
<webservices>
<title>Photos</title>
<item>
<name>test</name>
</item>
</webservices>
The programme display :
webservices = {
item = {
name= "test";
}
title = Photos;
};
}
A idea ?
Thanks a lot 🙂
That’s normal – if there is only one item, there’s no need to wrap a single item in an array. Your handler just needs to get the
[webservice valueForKey:@"item"]out as anid, then check what class it is. If it’s not anNSArray, just wrap it in one before moving on to whatever “process” method you’re calling.