So far i have been having a great experience with Ember but one thing i feel i am not doing right is the data access. My application is almost a pure data reader and when it does need to submit data it is all submitted via the url as it is more a command like rest but with no data. My issue is currently 2 fold.
- My source data is in an XML format
- A lot of the time i don’t want to cache my data or i need to refresh it frequently
The XML data i can currently handling using xslToJson library which gives me the same javascript object structure if would have if the data was loaded via json but sadly it does not follow the standards ember-data expects and had quite a few layers to it (lots of children etc). Currently i have the loading and working by having my controllers call $.get method that gets the xml and converts it to javascript object but this does not feel like the correct way to do this sort of thing in Ember. The other thing i have not worked out is the correct way/time to load children data as it gets a little complex.
My datasource is a “Plex Media Server” and the majority of the api works like this
- /Metadata/5 (displays info for item 5)
- /Metadata/5/children (displays info for item 5 and contains a property that has an array of child instances. Each of these child instance has the same content as /Metadata/id where the id is the id on the child )
- /Metadata/x/children (where x is the child if from above) (displays the info for the child and its children.)
There are other url’s but i have not investigated them yet. most of the data is accessed based on the 2 url formats above.
Am i better off just loading my data via my controllers like i currently am or is there some better way i should be loading this data? I am not sure if ember-data is the best fit due to the strange way the url works as well as the data been returned is quite structured and changes based on the type of item the metadata is for(i think it changes i still need to do some tests on this)